File from byte array file size

Greetings,

Why is it that when i upload a byte array (string) encoded as a Base64 string using POSTMAN the uploaded file is just 3KB in size but when i upload the same file from an android client using REST api the upload file size is a whooping 571KB?

Regards,
George

Hi, George.

  1. What is your appId.
  2. Please, provide small code snippet where you upload file.

Hi Oleg,

850D233C-6AC2-244C-FFC5-ED60D85BFB00

I am making an asynchronous HTTP request to thebackendless server using RxJava and Retrofit as below

@Headers("Content-Type: text/plain")
@PUT("files/binary/photos/{fileName}?overwrite=true")
Single<String> uploadFileFromByteArray(@Body String base64ImageString, @Path("fileName") String fileName);

Regards,
George

Hi, George.
I’ve tried load file to your app with curl and with Android-sdk (Backendless.Files.upload( )) – all files have the same size.
Also, i tried with simple URL/URLConnection, and i didn’t make any encode/decode operations, they are not necessary.

Also pay attention to the “Content-Type” header. It should be like in documentattion:
https://backendless.com/docs/rest/doc.html#file-upload

Am using SAVE BYTE ARRAY DOCUMENTATION, just below what you sent. See attached

Hi again George,

Did you compare the actual content of both files you uploaded via Postman and Java?
P.S.: Making the call using Retrofix?

Anton

Hi Anton, i succeeded getting desired file sizes using the file-upload api as opposed to saving file from byte array.

You can close the topic.

Regards,
George