Read File

Table of Contents

Overview

This JS API task downloads the content of a file from a File upload, Image, Audio, Video, or Signature field of a specific record, in a Zoho Creator application.

Request Details

Syntax

ZOHO.CREATOR.FILE.readFile(config).then(function(response){
   //callback block
});

Syntax Details

The syntax holds:

  • <config> (object) - The configuration required to download a file from a specific record of a report. This configuration includes the following parameters.
NameTypeDescription
app_name
(Optional)
string

Link name of the application from which a file needs to be downloaded. Retrieve the link name using the Creator report's URL: https://creatorapp.zoho.com/<account_name>/<app_name>/#Report:<report_name>

Note: This parameter only needs to be passed when you need to read data from other applications in the same Creator account. When not specified, data will be pulled from the current application.
report_namestringLink name of the report from which the file has to be downloaded. Retrieve the link name using the Creator report's URL: https://creatorapp.zoho.com/<account_name>/<app_name>/#Report:<report_name>
idstringThe ID of the target record that you want to read the file from.
field_namestring

The link name of the target field from which the file needs to be downloaded. The field link names can be found in the field properties pane of each field in the form builder.
Supported target fields: File upload, Image, Audio, Video, or Signature field

Note: If the target field (field inside subform) is situated inside a subform field (field in main form), the field_name will be <subformfield_link_name.targetfield_link_name>.

parent_id
(Optional)
stringIf the target field is situated inside a subform, then the parent_id is the ID value of the parent record. This means the main form's record in which the subform has been embedded.

Possible Errors

Refer to this page for the complete list of error codes and messages.

Sample Input

Copiedvar config = {
  app_name: "zylker",
  report_name: "All-Timesheet",
  id : "2000000193171",
  field_name : "Attachments"
};
ZOHO.CREATOR.FILE.readFile(config).then(function (response) {
  console.log(response);
});

Sample Response

Copiedresponse="filecontent"