Upload a File in a Folder

You can upload a file from your local system to an existing folder in the File Store, by referring to the folder’s unique ID. You can upload an image, text document, CSV, or any type of file you need. The maximum size of a file that you can upload is 100 MB.

You must create a file object for the file to be uploaded and create a File Store instance, as shown below. You must then fetch the folder details by passing its Folder ID in getFolderInstance(), and upload the file object to the folder instance using the uploadFile() method.

A unique File ID is created for the file after it is uploaded.

Note : Catalyst provides 1 GB of File Store space for each project in the development environment. There are no upper limits for storage in the production environment.

Ensure the following packages are imported:

    
copy
import com.zc.component.files.ZCFile; import com.zc.component.files.ZCFolder; import java.io.File;
    
copy
// Create a file object File f = new File("empdetails.csv"); //Create an instance for the File Store ZCFile fileStore = ZCFile.getInstance(); //Get a folder instance using the Folder ID ZCFolder folder = fileStore.getFolderInstance(1510000000109393); //Upload the file using the folder instance folder.uploadFile(f);

Last Updated 2023-09-03 01:06:41 +0530 +0530

ON THIS PAGE