www.dextsolution.com
DEXTUPLOAD
X5
menu toggleReference > component

getUploadMode

  • Version 1.0.0.0 or later

  • Explanation

    Returns the upload method.

  • Uses

    mode = component.getUploadMode();
  • Return

    The upload method, 'ORAF', 'OROF', 'EXTS', 'AWSS3', 'NCPOS', 'AZRBS' is returned. The default value is 'ORAF'.

setUploadURL

  • Version 1.0.0.0 or later

  • Explanation

    Set the server-side upload address.

    In order to upload files, you must set the upload path.

    DEXTUploadX5 is only responsible for transmitting data encoded as multipart/form-data to the server according to the RFC1867 protocol.

    The server-side upload address should be implemented as a service that receives and stores data encoded as multipart/form-data.

    function onDX5Created(id) {
      var dx = dx5.get(id);
      // Set the upload processing address.
      dx.setUploadURL("http://domain/path/common-upload.do");
    }
  • Uses

    component.setUploadURL(url);
  • Parameters

    Name Type Explanation
    url String The address of the server to process file uploads, must be the full path including the schema (http, https).

setUploadMode

  • Version 1.0.0.0 or later

  • Explanation

    Sets the upload method.

    DEXTUploadX5 supports three modes for file upload operation.

    • ORAF (default): Sends all files to be uploaded in one request. When the upload is completed, the response data becomes one.
    • OROF: Requests are made as many as the number of files to be uploaded. When uploading is completed, response data is generated by the number of files.
    • EXTS: Same as OROF, but it is used when individual or all files are larger than 2GB.
    • AWSS3: Used when uploading files to Amazon S3. Supported from 4.0.0.0 onwards.
    • NCPOS: Used when uploading files to NAVER CLOUD PLATFORM Object Storage. Supported from 4.2.0.0 onwards.
    • AZRBS: Used when uploading files to Azure Blob Storage. Supported from 4.3.0.0 onwards.
    function onDX5Created(id) {
      var dx = dx5.get(id);
      // Use the OROF upload method. 
      dx.getUploadMode("OROF");
    }
  • Uses

    component.setUploadMode(mode);
  • Parameters

    Name Type Explanation
    mode String Set one of 'ORAF', 'OROF', 'EXTS', 'AWSS3', 'NCPOS'. The default value is 'ORAF'.

getUploadStatus

  • Version 1.0.0.0 or later

  • Explanation

    Returns an object with the current upload status information.

    When the file is used in the process of uploading, the upload status information can be obtained.

    Using this function, the returned object does not have a different value depending on the time, but has only the copied value of the state at the time of the function call.

    To keep changing the uploading process, you need to use a function such as setTimeout.

    function toggleUploadStatus(isBegin) {
      function uploadProgress() {			
        var dx = dx5.get("dext5"), 
            out = document.getElementById("upstatus-value"), 
            status = dx.getUploadStatus();
        out.innerHTML = "" + 
          "name: " + status.currentName + "<br/>" + 
          "speed: " + status.totalSpeed + "(sec)<br/>" + 
          "count(completed/total): " + status.completeCount + "/" + status.totalCount + "<br/>" + 
          "current rate: " + status.currentRate + " % <br/>" + 
          "current size(sended/total): " + status.currentSendSize + "/" + status.currentSize + " (bytes)<br/>" + 
          "current time(past/remained): " + status.currentTime + "/" + status.remainedCurrentTime + "<br/>" + 
          "total rate: " + status.totalRate + " % <br/>" + 
          "total size(sended/total): " + status.totalSendSize + "/" + status.totalSize + " (bytes)<br/>" + 
          "total time(past/remained): " + status.totalTime + "/" + status.remainedTotalTime + "<br/>" + 
          "";
        if (window.isUploading === true) {
          setTimeout(uploadProgress, 1000);
        }
      }
      window.isUploading = isBegin;
      if (isBegin) uploadProgress();
    }

    When uploading files using the ORAF method, it is not possible to distinguish status values for individual files. Therefore, the value of completeCount has the same value as totalCount when the upload is complete and remains at 0 during the upload. Also, since current and total always have the same value, the values of currentSendSize, currentTime, and currentRate are meaningless. Therefore, only totalRate, totalSendSize, totalSize, totalTime, and remainedTotalTime should be used in ORAF.

  • Uses

    status = component.getUploadStatus();
  • Return

    An object with an upload transfer status value

    The following is a description of the properties of the object.

    Name Type Explanation
    completeCount Number Number of uploaded files
    currentName String Name of file being uploaded
    currentSize Number Size of file being uploaded
    currentSendSize Number Size of file in progress
    currentRate Number Progress of the file being uploaded
    currentTime Number, String The time (msec) at which the uploaded file is uploaded.
    remainedCurrentTime Number, String The remaining time (msec) before the file being uploaded is completed.
    totalSize Number Total size to upload
    totalCount Number Number of files to upload
    totalSendSize Number Total size uploaded
    totalRate Number Overall upload progress
    totalSpeed Number Total upload speed (bytes / sec)
    totalTime Number, String The whole upload progress time (msec)
    remainedTotalTime Number, String The remaining time (msec) for the whole files

getUploadURL

  • Version 1.0.0.0 or later

  • Explanation

    Returns the server-side upload processing address.

    In order to upload files, you must set the upload path.

    DEXTUploadX5 is only responsible for transmitting data encoded as multipart/form-data to the server according to the RFC1867 protocol.

    The server-side upload address should be implemented as a service that receives and stores data encoded as multipart/form-data.

    function onDX5Created(id) {
      var dx = dx5.get(id);
      // Output the server-side upload processing address.
      console.log(dx.getUploadURL());
    }
  • Uses

    url = component.getUploadURL();
  • Return

    Server-side upload processing address

getUploadTimeInterval

  • Version 3.10.0.0 or later

  • Explanation

    Returns the time interval value between file upload operations.

  • Uses

    interval = component.getUploadTimeInterval();
  • Return

    Time interval value in milliseconds (1/1000)

setUploadTimeInterval

  • Version 3.10.0.0 or later

  • Explanation

    Sets the time interval value between file upload operations.

    If the file upload method is OROF or EXTS, multiple upload operations will occur depending on the number of files to upload and the number of chunks, each operation will be delayed by the given time value.

    var dx = dx5.get("component-id");
    dx.setUploadTimeInterval(1000);
    
  • Uses

    component.setUploadTimeInterval(interval);
  • Parameters

    Name Type Explanation
    interval Number

    The time value is in milliseconds (1/1000), and cannot be set to less than 20 ms.

pauseUploading

  • Version 3.10.0.0 or later

  • Explanation

    Pause an upload job.

    You can use the function to pause an upload job. While the upload is paused, you can resume the upload operation using the resumeUploading function.

    <button type="button" onclick="pause('component-id');">Pause</button>
    <script>
    function pause(id) {
        dx5.get(id).pauseUploading();
    }
    </script>
  • Uses

    component.pauseUploading();

resumeUploading

  • Version 3.10.0.0 or later

  • Explanation

    Resume a paused upload job

    The pauseUploading method is available only when a download operation is paused using the pauseUploading method or when it is paused because an error occurs.

    • In the ORAF method, resuming an upload operation restarts the upload from the beginning.
    • In the OROF method, resuming the upload resumes the upload from the file where it was stopped.
    • In the EXTS method, resuming the upload resumes the upload from the chunk that was stopped.
    • In the AWSS3 method, resuming the upload resumes the upload from the chunk that was stopped.
    <button type="button" onclick="resume('component-id');">Resume</button>
    <script>
    function resume(id) {
        dx5.get(id).resumeUploading();
    }
    </script>
  • Uses

    component.resumeUploading();

setAWSS3UploadConfig

  • Version 4.0.0.0 or later

  • Explanation

    Define settings for uploading files to Amazon S3.

    dx.setUploadMode("AWSS3");
    dx.setAWSS3UploadConfig({
        type: "NON-SECRET",
        accessKeyId: "ABCD...1234",
        secretAccessKey: "ABCD...1234",
        region: "ap-northeast-2",
        bucket: "abc-bucket"
    });
  • Uses

    component.setAWSS3UploadConfig(config);
  • Parameters

    Name Type Explanation
    config Object

    The config parameter object has as properties the settings for uploading.

    Property Explanation
    type Set to 'NON-SECRET' if uploading directly from a browser using the AWS SDK, 'SECRET' if uploading using a Presigned URL, or omit.
    region Set the region, which is only valid if the type attribute is 'NON-SECRET'.
    bucket Sets the bucket name. Valid only if the type attribute is 'NON-SECRET'.
    accessKeyId Sets the access key. Valid only if the type attribute is 'NON-SECRET'. (Important security item)
    secretAccessKey Sets the secret access key. Valid only if the type attribute is 'NON-SECRET'. (Important security topic)
    storageClass Sets the storage class ('STANDARD', 'REDUCED_REDUNDANCY', 'STANDARD_IA', 'ONEZONE_IA', 'INTELLIGENT_TIERING', 'GLACIER', 'DEEP_ARCHIVE'). The default value is 'STANDARD' and can be set regardless of the type attribute.
    acl Sets the permissions ('private', 'public-read', 'public-read-write', 'authenticated-read', 'aws-exec-read', 'bucket-owner-read', 'bucket-owner-full-control') of the file object to be uploaded. The default is 'private', and depending on S3's bucket permission settings, the acl attribute may not be available. This can be set regardless of the type attribute.
    chunkSize Sets the chunk size to use when splitting files. The default is 10 MB and can be set from 5 MB to 5 GB. Can be set regardless of the type attribute.
    makeKey

    Sets the function to use when manually creating a key. The function has an item parameter and should return a string key value.

    dx.setAWSS3UploadConfig({
        makeKey: item => {
            return item.name;
        }
    });
    initURL Sets the address responsible for initializing the upload process. Valid only if the type attribute is 'SECRET' or omitted.
    signedURL Sets the address responsible for generating the Presigned URL. Valid only if the type attribute is 'SECRET' or omitted.
    completeURL Sets the address responsible for completing the upload process. Valid only if the type attribute is 'SECRET' or omitted.
    sdkURL Sets the address where you can download the AWS SDK. The default value is 'https://sdk.amazonaws.com/js/aws-sdk-2.1037.0.min.js'.

setNCPOSUploadConfig

  • Version 4.2.0.0 or later

  • Explanation

    Define settings for uploading files to NAVER CLOUD PLATFORM Object Storage .

    dx.setUploadMode("NCPOS");
    dx.setNCPOSUploadConfig({
        type: "NON-SECRET",
        accessKeyId: "ABCD...1234",
        secretAccessKey: "ABCD...1234",
        // kr, us, sg, jp, de
        region: "kr",
        bucket: "abc-bucket"
    });
  • Uses

    component.setNCPOSUploadConfig(config);
  • Parameters

    Name Type Explanation
    config Object

    The config parameter object has as properties the settings for uploading.

    Property Explanation
    type Set to 'NON-SECRET' if uploading directly from a browser using the AWS SDK, 'SECRET' if uploading using a Presigned URL, or omit.
    region Set the region, which is only valid if the type attribute is 'NON-SECRET'.
    bucket Sets the bucket name. Valid only if the type attribute is 'NON-SECRET'.
    accessKeyId Sets the access key. Valid only if the type attribute is 'NON-SECRET'. (Important security item)
    secretAccessKey Sets the secret access key. Valid only if the type attribute is 'NON-SECRET'. (Important security topic)
    acl Sets the permissions ('private', 'public-read', 'public-read-write', 'authenticated-read') of the file object to be uploaded. The default is 'private', and depending on S3's bucket permission settings, the acl attribute may not be available. This can be set regardless of the type attribute.
    chunkSize Sets the chunk size to use when splitting files. The default is 10 MB and can be set from 5 MB to 5 GB. Can be set regardless of the type attribute.
    makeKey

    Sets the function to use when manually creating a key. The function has an item parameter and should return a string key value.

    dx.setNCPOSUploadConfig({
        makeKey: item => {
            return item.name;
        }
    });
    initURL Sets the address responsible for initializing the upload process. Valid only if the type attribute is 'SECRET' or omitted.
    signedURL Sets the address responsible for generating the Presigned URL. Valid only if the type attribute is 'SECRET' or omitted.
    completeURL Sets the address responsible for completing the upload process. Valid only if the type attribute is 'SECRET' or omitted.
    sdkURL Sets the address where you can download the AWS SDK. The default value is 'https://sdk.amazonaws.com/js/aws-sdk-2.1037.0.min.js'.

setAZRBSUploadConfig

  • Version 4.3.0.0 or later

  • Explanation

    Defines the configuration values for uploading files to Microsoft Azure Blob Storage.

    dx.setUploadMode("AZRBS");
    dx.setAZRBSUploadConfig({
        accountName: "photomanager",
        containerName: "photos",
        sasListURL: "https://example.com/get-list-sastoken.ashx",
        sasUploadURL: "https://example.com/get-upload-sastoken.ashx"
    });
  • Uses

    component.setAZRBSUploadConfig(config);
  • Parameters

    Name Type Explanation
    config Object

    The config parameter object has as properties the settings for uploading.

    Property Explanation
    accountName Set the Azure Blob Storage account name.
    containerName Set the Azure Blob Storage container name.
    accessTier Select from ‘Hot, Cool, Cold, Archive’.
    chunkSize Set the chunk size used when splitting files. The default is 10MB, and you can set it from 5MB to 4000MB. It can be set regardless of the type attribute.
    makeKey

    Sets the function used when manually creating a key (key = blob name). The function has an item parameter and must return a string key value.

    dx.setAZRBSUploadConfig({
        makeKey: item => {
            return item.name;
        }
    });
    sasListURL Set the URL for obtaining a shared access token to retrieve the block list of uncommitted blobs.
    sasUploadURL Set the URL for obtaining a shared access token for uploading blob blocks.