Skip to content

File Upload

The file upload operation delivers and saves a local file in the remote Backendless file storage. The return value of the operation is the file URL which has the following structure:<application id>/<REST-API-key>/files/<path>/<file name>


Argument                Description
<application id> ID of the application which can be obtained from the Manage > App Settings screen of the Backendless Console
<REST-API-key> REST API key of your application. You can get the value from the Manage > App Settings section of the Backendless Console. Note that if the file is created from Cloud Code (JS, Java or Codeless), the API key in the file path will be the CodeRunner API Key.
<path> directory path where the file is saved
<file name> name of the file

The URL assigned to a file and returned as a result of the upload operation accounts for any security permissions assigned to the file (or the folder it is located in).





Argument                Description
<application-id> the ID of your application generated upon its creation. You can get the value in the Manage > App Settings section of the Backendless Console.
<REST-api-key> REST API key of your application. You can get the value from the Manage > App Settings section of the Backendless Console.
<path> directory path in the Backendless file storage where the file should be stored. If the path does not exist, Backendless File Service creates the directory structure.
<filename> name of the file the upload is saved as.
overwrite defines whether a newly saved file overwrites the existing file. If the argument value is true, the new file overwrites the existing one. Otherwise, if the value is false or the overwrite parameter is not present, and another file with the same name already exists, the server returns an error.

Request headers

Content-Type: multipart/form-data  
user-token: optional value obtained as a result of the login operation.


Argument                Description
Content-Type Must be set to multipart/form-data. This header is mandatory.
user-token Optional header. Contains a value returned by Backendless in a preceding user Login API call. If user-token is set in the request, the currently logged in user will be assigned to the ownerId property of the user object which is being saved.  Additionally, the operation will be executed with the security policy associated currently logged in user. This means all permissions associated with the user and the roles assigned to the user will be enforced by Backendless.

Request Body:

File contents formatted per the multipart/form-data requirements.

Response Body

  "fileURL" : file URL which should be used to download the file  


curl -H Content-Type:"multipart/form-data" \  
--form upload=@test.txt \  
-X POST \