Comment on page
Create file object
This action node is used to create a new file object containing a file and associated metadata. To understand the differences in behavior when creating an object in a database-connected data source compared to a runtime-only data source, see Database-connected and runtime-only data sources under Data sources.
A file can be added from several sources:
- The file system of a client user's computer or mobile device.
- The camera on a client user's mobile device (image or video).
- A URL.
- A string or blob.
When uploading files from the file system, the action node supports multiple simultaneous uploads using the Max Selectable Files property. This allows a client user to select multiple files in the file browser, or to drag and drop multiple files on a container configured for file drop.
Images can be resized (with Max Image Size) and compressed (with Compress Image) on upload in order to control file sizes. When these features are enabled, images will be converted to JPEG format. Transparency is not supported and any transparent parts of an image will become black.
By default, files in a file object require authentication to access. If required, a file can be made available for public distribution to unauthenticated users by selecting the Public property.
When adding a file from a URL, both public and authenticated URLs are supported. Secrets can be used in either the URL or a request header by selecting the Run on Server property.
Is the file browser or camera not opening?
The Create File action node, with Source Type Default (opening the file browser or device camera on your phone), is in some cases required to be the first action node of the action in order for the browser to interpret the operation as "user-initiated". This has been seen in Safari on iPhone. The solution is to move the Create File Object as the first action node, and then do additional logic.