Deluge Help

Upload files

Overview

The zoho.docs.uploadFile() task is used to upload a file in your Zoho Docs account. You can specify the folder and the workspace in which the file needs to be placed.

Syntax

<response> = zoho.docs.uploadFile(<FileDetails>,<FolderID>,<WorkSpaceID>);​

where,
response - response returned as map from Zoho Docs.
FileDetails - Details of the file to be uploaded. It must be specified as a map data type, in the following format:  {"filename" : "​<name_of_the_file>", "content" : "<content_of_the_file>"}
FolderID - ID of the Folder in which the file will be uploaded. It is of string data type. This is an optional param.
WorkSpaceID - ID of the Workspace in which the file will be uploaded. It is of string data type. This is an optional param.

(or)

<response> = zoho.docs.uploadFile(<FileContent>,<FolderID>,<WorkSpaceID>);​

where,
response - response returned as map from Zoho Docs.
FileContent - content of the file to be uploaded in text format. Or you can directly specify a File Upload field type, in the format - input.<file_upload_field>
FolderID - ID of the Folder in which the file will be uploaded. It is of string data type. This is an optional param.
WorkSpaceID - ID of the Workspace in which the file will be uploaded. It is of string data type. This is an optional param.

Examples

1) The following script uploads a file with the specified file name and specified content.

response = zoho.docs.uploadFile({"filename":"TEST","content":"This is a test file"});

where,
"TEST" - is the name of the file being uploaded.
"This is a test file" - is the content of the file being uploaded.

2) The following script uploads a file with the specified content. A name for the file is assigned by Zoho Creator.

response = zoho.docs.uploadFile(This is a test file);

where,
"This is a test file" - is the content of the file being uploaded.

3) The following script uploads a file from a Zoho Creator form.

response = zoho.docs.uploadFile(input.Resume);

where,
Resume - is the file upload field name.

Sample Response

The response returned is of the following format

{  
   "response":[  
      {  
         "uri":"/files/v1/upload"
      },
      {  
         "message":"UPLOAD_SUCCESS"
      },
      {  
         "result":[  
            {  
               "documentname":"M.Sch._Kaufmännische_Mitarbeiterin.pdf"
            },
            {  
               "uploaddocid":"3rxha347a3e4d504e434bbd2428f5e4a13eaf"
            }
         ]
      }
   ]
}

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com