Greetings,
What is the REST equivalent of the SDK code below for uploading a Bitmap. It’s not clear in the REST documentation. If possible avoiding a base64 String conversion.
public void Backendless.Files.upload(
android.graphics.Bitmap bitmap,
android.graphics.Bitmap.CompressFormat compressFormat,
int quality,
String remoteName,
String remotePath,
AsyncCallback<BackendlessFile> responder ) throws Exception
I would really appreciate a simple curl illustration.
Regards,
George
Hi George
here is link to the docs and example
https://backendless.com/docs/rest/doc.html#file_save_files_from_byte_arrays
but with base64
Why you don’t want to encode it base64?
Regards, Vlad
Hi Vladimir,
base64 results in a bigger file size, 468.00 KB+ for a thumbnail.
In the theory section it is indicated:
Request headers:
Content-Type: multipart/form-datauser-token: optional value obtained as a result of the login operation.
While in the curl example immediately following the theory above you used text/plain as the Content-Type. Which one is to be used?
Example:
curl -H Content-Type: text/plain
-X PUT \
-v [url=https://api.backendless.com/XXXX-XXXX-XXXX/ZZZZ-ZZZZ-ZZZZ/files/binary/testFolder/savedNote.txt?overwrite=true]https://api.backendless.com/XXXX-XXXX-XXXX/ZZZZ-ZZZZ-ZZZZ/files/binary/testFolder/savedNote.txt?overwrite=true"[/url]; \
-d bXkgY29vbCBub3Rl
ok, try this:
curl 'https://api.backendless.com/APP_ID/API_KEY/files/my-folder/my-img.jpg?overwrite=true' -F 'files[]=@/Absolute/Path/To/file.jpg'
Hi Vladimir, i succeeded, thanks.
You can close the topic.
Regards,
George