Skip to content

Save Files From Byte Arrays

In addition to the classic file upload, files can be saved by uploading a byte array which becomes the content of the saved file.

You can save a file with or without overwriting the existing file. To specify this, use overwrite argument.



Endpoint URL

The is a subdomain assigned to your application. For more information see the Client-side Setup section of this documentation.<filePath>?overwrite=true


Argument                Description
<filePath> Path to a directory where the file will be stored located.
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:

A byte array encoded as a Base64 string.

Response Body

URL of the newly saved file or an error.


The example below saves the "savedNote.txt" file with the content "my cool note". The content must be encoded in the Base64 format, hence the value is "bXkgY29vbCBub3Rl":


Make sure to replace xxxx in the domain name in the sample request below to the one assigned to your application.

curl -H Content-Type: text/plain -X PUT \  
-v" \  
-d bXkgY29vbCBub3Rl


Argument                Description
-d The request body
bXkgY29vbCBub3Rl A byte array (string) encoded as a Base64 string. The decoded value is "my cool note".

The server will return the URL of the newly saved file:


If you decide not to overwrite the existing file,the overwrite argument may be skipped or set to false. In that case, if the file already exists, a new file is not saved and server will return an error. If the file does not exist, the server will return the URL of the newly saved file.


When the server-side reports an error, it returns a JSON object in the following format:


Error codes returned on attempt to save a file from the byte array.

Error Code
When saving a new file from the byte array, the payload exceeds 2,800,000 bytes.
A file you are trying to save already exists in the system and cannot overwrite since overwrite argument is ether set to false or omitted.