renaming an image that I upload

Hi dear Backendlesses!

trying to upload an image to Backendless which I want to rename programmatically to the name of the user.

I know how to upload a file with a default name when I use line. works great:

Backendless.Files.upload(imageFile, "userpics", new AsyncCallback<BackendlessFile>() {

but it’s full of errors and doesn’t work when I try the line from the “” documentary, in which It’s suppose to let me change the name of the image:

Backendless.Files.Android.upload(imageFile, Bitmap.CompressFormat.PNG, 100, "myphoto.png", "mypics",
        new AsyncCallback<BackendlessFile>() {

please help, what’s wrong with the syntax I’m using in the second code line ?


I believe that my problem is that I get from the phone gallery a Uri : Uri selectedImage = data.getData();
and then I do: File imageFile = new File( getRealPathFromURI( selectedImage ) );but I need a Bitmap in order to run the code from the documentary (though I don’t know why I can’t rename a file if it’s not a Bitmap…).

Hi Gil,

Perhaps this would be helpful: