www.dextsolution.com
DEXTUPLOAD
X5
Reference > component

## addVirtualFile

- Version 1.0.0.0 or later

- Explanation

  Add the virtual file.

  A virtual file is a fake file that does not exist on the user's local PC and has no substance. In general, virtual files are used to keep information about already uploaded files. That is, it is used as an indication that the file exists in the server. It is not a file to upload because it is not actually locally present.

  To add a virtual file, use the addVirtualFile function or the addVirtualFileList function.

      function onDX5Created(id) {
          // The virtual file is usually added at the time the component is created.
          var dx = dx5.get(id);
          // When adding individually
          dx.addVirtualFile({ vindex: "IDX0001", name: "virtual_file.txt", size: 12345 });
          dx.addVirtualFile({ vindex: "IDX0002", name: "virtual_file_lock.txt", size: 45678, lock: true });
          dx.addVirtualFile({ vindex: "IDX0003", name: "cosmos.jpg", size: 195779 });
          // When adding at once
          dx.addVirtualFileList([
              { vindex: "IDX0004", name: "virtual_file.txt", size: 12345 },
              { vindex: "IDX0005", name: "virtual_file_lock.txt", size: 45678, lock: true },
              { vindex: "IDX0006", name: "cosmos.jpg", size: 195779 }
          ]);
      }

  When the virtual file is added, the onDX5BeforeItemsAdd, onDX5BeforeItemAdding, and onDX5ItemsAdded callback functions are not called.

- Uses

      component.addVirtualFile(vf);

- Parameters

  Name | Ver. | Type | Explanation
  --- | --- | --- | ---
  vindex |  | String | A unique key that distinguishes a virtual file. It can be in any format, but it should not be duplicated.
  name |  | String | The name of the virtual file.
  size |  | Number | The size of the file in bytes.
  lock |  | Boolean | Set whether the virtual file is locked. If the value is true, it is not deleted.
  middlePathr |  | String | This attribute is used for downloading folder structures, and is the name of the folder the virtual file belongs to. Use HD to download the folder structure.
  url, downUrl, openUrl, thumbUrl, thumb |  | String | The path to the actual web resource that the virtual file is pointing to. It should be set to the full path, including schema. Use the url (since 1.4.1.0), downUrl attribute to download the file, openUrl to open the file, and thumbUrl (since 3.9.0.0), thumb attribute to thumbnail the file.
  checked | 1.3.2.0 | String | Set whether it is checked or not. If true, added with checked status.
  eventUriStart | 2.0.0.0 | String | Use to set the event address used when using file downloads in the HD application. The event address is a web address, which must be a full URL containing a schema (http, https). When downloading an item in the HD application, if it is set, it sends a GET request to that address before downloading.
  eventUriStop | 2.0.0.0 | String | Use to set the event address used when using file downloads in the HD application. The event address is a web address, which must be a full URL containing a schema (http, https). When downloading an item in the HD application, if this property is set, it sends a GET request to the address when the download stops. (This is not a stop due to an error, but a stop by a user action.)
  eventUriEnd | 2.0.0.0 | String | Use to set the event address used when using file downloads in the HD application. The event address is a web address, which must be a full URL containing a schema (http, https). When downloading an item in the HD application, if this property is set, it sends a GET request to that address when the download is complete.
  chunkSize | 2.0.0.0 | Number | Set the size at which files are split when using file downloads in the HD application. When downloading in the HD application, do not download the file at one time with a single request, but do so by dividing it by a given size. If you download the file by dividing it, the file downloading time may take a little longer, but you can run the server more reliably. If the size of the file to be downloaded is large, the bandwidth is caught until the file is downloaded, which may cause performance problems. Splitting a file in such a case will reduce downloading requests to the server, which will reduce the likelihood that some users will occupy server resources for a long time. If it is not specified, it is set to -1 value. If it is -1 or 0, it is received as one request without splitting the file. In addition, the partition size must be specified in MB only.
  hdTitle | 2.1.2.0 | String | Represent text output to the window title when using file downloads in the HD application. When the file is downloading, the text and filename are displayed in the window title area of ​​the HD application. If there is no specified value, the product name and version are displayed.
  meta | 3.2.0.0 | Object | Use this when you want to set meta data at the time of virtual file registration. This property can be used as a custom column value in the GRID style. Example) meta: { type: "A", color: "B" }

## addVirtualFileList

- Version 1.0.0.0 or later

- Explanation

  Add the virtual files at once using the array.

  A virtual file is a fake file that does not exist on the user's local PC and has no substance.

  In general, virtual files are used to keep information about already uploaded files. That is, it is used as an indication that the file exists in the server.

  It is not a file to upload because it is not actually locally present.

  To add a virtual file, use the addVirtualFile function or the addVirtualFileList function.

      function onDX5Created(id) {
        // The virtual file is usually added at the time the component is created.
        var dx = dx5.get(id);
        // When adding individually
        dx.addVirtualFile({ vindex: "IDX0001", name: "virtual_file.txt", size: 12345 });
        dx.addVirtualFile({ vindex: "IDX0002", name: "virtual_file_lock.txt", size: 45678, lock: true });
        dx.addVirtualFile({ vindex: "IDX0003", name: "cosmos.jpg", size: 195779 });
        // When adding at once
        dx.addVirtualFileList([
          { vindex: "IDX0004", name: "virtual_file.txt", size: 12345 },
          { vindex: "IDX0005", name: "virtual_file_lock.txt", size: 45678, lock: true },
          { vindex: "IDX0006", name: "cosmos.jpg", size: 195779 }
        ]);
      }

  When the virtual file is added, the onDX5BeforeItemsAdd, onDX5BeforeItemAdding, and onDX5ItemsAdded callback functions are not called.

- Uses

      component.addVirtualFileList(vfs);

- Parameters

  Name | Multi/IE | Type | Explanation
  --- | --- | --- | ---
  vfs | Array | The array of JSON objects with the virtual file information to add, refer to the addVirtualFile method.

## openFileDialog

- Version 1.0.0.0 or later

- Explanation

  Opens a file selection dialog for adding files to be uploaded.

  DEXTUploadX5 has no buttons or GUI elements to add files to the component itself.

  Instead, it provides a function that allows you to add files using a script.

  If there is a target selected in the file selection dialog window, the window is closed and it returns true.

      <button type="button" onclick="addFiles();">Button</button>
      <script>
      function addFiles() {
        var dx = dx5.get("component-id");
        dx.openFileDialog();
      }
      </script>

  If there is no code to handle the return value of the openFileDialog function, it can be automatically binded using the value of the btnFile property at the time of component creation.

      <button id="btn-add-files" type="button">Button</button>
      <script>
        dx5.create({
          ...,
          // the file add function is automatically binded.
          btnFile: "btn-add-files"
        });
      </script>

- Uses

      component.openFileDialog();

## openFolderDialog

- Mutlti-module version 3.6.0.0 later

- Explanation

  Opens the folder dialog window to add files and folder to upload.

  DEXTUploadX5 has no buttons or GUI elements to add folders to the component itself. Instead, it provides a function that lets you add a folder using a script.

      <button type="button" onclick="addFolder();">Button</button>
      <script>
      function addFolder() {
          var dx = dx5.get("component-id");
          dx.openFolderDialog();
      }
      </script>

  It can be automatically binded to a button by using the 'btnFolder' property at the time of component creation.

      <button id="btn-add-folder" type="button">Button</button>
      <script>
          dx5.create({
              ...,
              // The adding folder function is automatically binded
              btnFolder: "btn-add-folder"
          });
      </script>

- Uses

      component.openFolderDialog();