Upload files
Overview
This task is used to upload a file to the specified folder.
Syntax
<response> = zoho.docs.uploadFile(<fileDetails>, <folderID>, <workspaceID>);
where,
Parameter | Data type | Description |
<response> | KEY-VALUE | Variable which will hold the response returned by Zoho Docs. |
<fileDetails> | MAP | Content of the file can be in any of the following formats:
Note: In Zoho Creator, the input file or the text that will be converted into a file cannot be more than 50 MB. |
<folderID> (optional) | TEXT | is the ID of the folder in Zoho Docs in which the file will be created. The Folder ID can be viewed in the url when clicked on the folder in Zoho Docs. Folder IDs are also present in the response of retrieveFiles() task and getFolders() task. |
<workspaceID> (optional) | TEXT | is the ID of the workspace in Zoho Docs in which the file will be created. The Workspace ID can viewed in the url when clicked on the workspace in Zoho Docs. |
Example: Upload a file in Zoho Docs
The following script uploads a file in Zoho Docs with the given content.
response= zoho.docs.uploadFile({"filename" : "test", "content" : "This is a test file"});
where,
"filename"
"content"
"test"
"This is a test file"
Response
The success response returned is of the following format:
{
"response":[
{
"uri":"/files/v1/upload"
},
{
"message":"UPLOAD_SUCCESS"
},
{
"result":[
{
"documentname":"test"
},
{
"uploaddocid":"h0tih1a1f38e022XXXXXXXX31f76b661f0c9d"
}
]
}
]
}
The ID of the uploaded file can be fetched using the following snippet: