Explanation
A virtual file is a virtual file that does not exist on the user's local PC. 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 register a virtual file, use the addVirtualFile function or the addVirtualFileList function. Virtual files are registered in the json object format.
- vindex: (Required field) The unique key that distinguishes a virtual file. It can be in any format, but it should not be duplicated.
- name: (Required field) The name of the virtual file.
- size: The size of the virtual file, in bytes.
- lock: If the lock status is true, the file cannot be deleted.
var dx = dx5.get(id);
// When registering individually
dx.addVirtualFile({ vindex: "IDX0001", name: "virtual_file.txt", size: 12345 });
dx.addVirtualFile({ vindex: "IDX0002", name: "virtual_file_locked.txt", size: 45678, lock: true });
dx.addVirtualFile({ vindex: "IDX0003", name: "cosmos.jpg", size: 195779 });
// When registering several at once
dx.addVirtualFileList([
{ vindex: "IDX0001", name: "virtual_file.txt", size: 12345 },
{ vindex: "IDX0002", name: "virtual_file_locked.txt", size: 45678, lock: true },
{ vindex: "IDX0003", name: "cosmos.jpg", size: 195779 }
]);
Note that the addVirtualFile and addVirtualFileList functions register files asynchronously, so the code following the two functions can be executed first.
Example