The toFile function takes any content and creates a file object.
- It is advisable to use file objects from the cloud directly and only in the absence of such means should this task be used.
- The toFile task is not a utility to create files of desired type. It only helps wrapping up contents inside a file object. So there shall be instances where the file might appear broken or corrupted unless appropriate content is supplied during file creation.
- The file object would be created in the name of the file along with the extension(if provided).
|<variable>||BOOLEAN||Variable which will contain the created file object.|
The value that needs to be converted to a file object.
Note: In Zoho Creator, the input value cannot be more than 50 MB.
The value which will represent the file name and its extension.
Imagine that you need to upload a CSV file to workdrive under a particular folder. The toFile function can convert the csv content to a file with a specified name and extension.
csv_file="\"Name\",\"Age\"\n\"Mathew\",\"20\"".tofile("sample.csv"); zoho.workdrive.uploadFile(csv_file,"g5lg8678dc59b6c10007586b847fc1904c904","sample.csv",true,"work_drive_conn");// This would create a file in workdrive with the name sample.csv