Upload a File

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.

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.

You must create a file object for the file to be uploaded, as shown below. The fileobject is passed as an argument to the uploadFile() method. The upload starts only when the start() method is called. You must specify Folder ID of the folder while referring to it.

The folder reference used in the code below is the folder object created earlier.

The promise returned here will be resolved to an object in which the content key contains the details of the uploaded file. A unique File ID is created for the file after it is uploaded.

    
copy
var filestore = catalyst.file; var folder = filestore.folderId(7189310908031); //Specify the Folder ID var uploadPromise = folder.uploadFile(fileobject).start(); //Pass the file object and upload the file uploadPromise .then((response) => { console.log(response.content); }) .catch((err) => { console.log(err); });

A sample response that you will receive for each version is shown below:

    
Web SDK
copy
{
id: "2136000000020122",
file_location: null,
file_name: "shipmentdetails.csv",
file_size: "84881",
created_by: {
zuid: "66466723",
is_confirmed: false,
email_id: "amelia.burrows@zylker.com",
first_name: "Amelia",
last_name: "Burrows",
user_type: "Admin",
user_id: "2136000000006003"
},
created_time: "Aug 17, 2021 09:33 PM",
modified_by: {
zuid: "66466723",
is_confirmed: false,
email_id: "amelia.burrows@zylker.com",
first_name: "Amelia",
last_name: "Burrows",
user_type: "Admin",
user_id: "2136000000006003"
},
modified_time: "Jul 06, 2023 11:38 AM",
project_details: {
project_name: "ShipmentTracking",
id: 10103000000115000,
project_type: "Live"
},
folder_details: 10103000000114006
}
{
id: 2136000000020117,
file_location: null,
file_name: "empdata.csv",
file_size: 84881,
created_by: {
zuid: 66466723,
is_confirmed: false,
email_id: "emma@zylker.com",
first_name: "Amelia",
last_name: "Burrows",
user_type: "Admin",
user_id: 2136000000006003
},
created_time: "Aug 17, 2021 09:33 PM",
modified_by: {
zuid: 66466723,
is_confirmed: false,
email_id: "emma@zylker.com",
first_name: "Amelia",
last_name: "Burrows",
user_type: "Admin",
user_id: 2136000000006003
},
modified_time: "Aug 17, 2021 09:33 PM",
project_details: { project_name: "ShipmentTracking", id: 2136000000007733 },
folder_details: 2136000000008551
}

Last Updated 2023-07-12 12:52:30 +0530 +0530

ON THIS PAGE