Web Demos

BARCODE READER SDK DEMO

Explore the flexibe barcode reading settings to optimize for your specific usage scenario.

WEB TWAIN SDK DEMO

Try the most popular web scanner features: scan images, import local images and PDF files, edit, save to local, upload to database, and etc.

BARCODE READER JAVASCRIPT DEMO

Transform any camera-equipped devices into real-time, browser-based barcode and QR code scanners.

MRZ SCANNER WEB DEMO

Detects the machine-readable zone of a passport, scans the text, and parses into human-readable data.

APP STORE DEMOS

BARCODE READER SDK FOR IOS

BARCODE READER SDK FOR ANDROID

VIEW MORE DEMOS >
Dev Center
Table of contents

Document Saving

How can I send additional form fields with images to my server or database?

You can use SetHTTPFormField to set meta data as form fields and use HTTPUpload to send it to the server side with the scanned document.

// Clear old fields before adding new ones
DWObject.ClearAllHTTPFormField();
DWObject.SetHTTPFormField("FileType", "Insurance Doc");

You can check out this demo project for sending additional form fields when uploading the scanned document.

SetHTTPFormField can also be used to send image data in base64 or BLOB to the server side.

By design, the method HTTPUpload() only contains one file. But as it essentially sends an HTTP form to the server, you can attach multiple files in that form using the methods ConvertToBlob() and SetHTTPFormField() . Check out the following snippet on how it is done. NOTE that the method HTTPUpload() only has 3 parameters as it doesn’t need to specify a file anymore.

/**
 * Upload the images specified by their indices in the specified file type as separate files.
 * @param indices Specify the images
 * @param type Specify the file type
 */
function uploadSeparateFiles(indices, type) {
  var protocol = Dynamsoft.Lib.detect.ssl ? "https://" : "http://",
    port = window.location.port === "" ? 80 : window.location.port,
    actionPage = "/upload.aspx";
  // path to the server-side script
  var url = protocol + window.location.hostname + ":" + port + actionPage;
  if (DWObject) {
    var done = 0,
      count = indices.length;
    var toBlob = function (index) {
      var fieldName = "SampleFile_" + index;
      var fileName = fieldName + getExtension(type);
      DWObject.ConvertToBlob(
        [index],
        type,
        function (result, _indices, type) {
          DWObject.SetHTTPFormField(fieldName, result, fileName);
          done++;
          if (done === count) {
            DWObject.HTTPUpload(
              url,
              function () {
                console.log("Success");
              },
              function (errCode, errString, responseStr) {
                console.log(errString);
              }
            );
          } else {
            toBlob(indices[done]);
          }
        },
        function (errorCode, errorString) {
          console.log(errorString);
        }
      );
    };
    toBlob(indices[done]);
  }
}

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest Version
    • Version 17.2.1
    • Version 17.1.1
    • Version 17.0
    • Version 16.2
    • Version 16.1.1
    Change +
    © 2003–2022 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support