Choose where you’d like to start

Get File Type

Note: This function is applicable to all Zoho services. In Zoho Creator, this function can be applied only on files fetched using the invokeUrl task and not on the files fetched from Zoho Creator fields.

Description

The getFileType task is used to get the type of the specified file.

Syntax

<response> = <file_object>.getFileType();

where,

ParamsData typeDescription

<response>

TEXT

specifies the response returned by the getFileName task. It represents the name of the file.

<file_object>

FILE

specifies the file object whose type needs to be fetched. The file can be fetched from the cloud using the invokeUrl task.

Example

The following script returns the type of the file that the variable - fileVariable holds.

// to fetch file from the cloud using invokeUrl task
 fileVariable = invokeUrl
 [
  url: "https://sample-videos.com/img/Sample-png-image-100kb.png"
  type: GET
 ];
 // to fetch the file type
 response = fileVariable.getFileType(); // returns image/png

where,

response
is the TEXT response returned by the getFileType task. It represents the type of the specified file.
fileVariable
is the FILE variable that holds the file whose type needs to be fetched

Related Links

Get Started Now

Execute