Error downloading file from backendless server || android

Hello

I am downloading an file from back-endless server using HttpURLConnection … and I get The file public URL by the user property “UserPhoto”… userphoto is the public URL for the photo of every user (in my app )

The code for getting the file is in AsyncTask class …
and I get IOException saying FileNotFoundException

That is the code for downloading the file :

URL photo_url = new URL(params[0]);
HttpURLConnection getPhoto =(HttpURLConnection)photo_url.openConnection();
getPhoto.setDoInput(true);
getPhoto.setRequestMethod("GET");
getPhoto.connect();
InputStream photo = getPhoto.getInputStream();
user_photo = BitmapFactory.decodeStream(photo);

While “params” is an array containing the File public URL …
the file I am downloading is image … And Thanks

See the answer for this question on stackoverflow for an example:

Also, what value do you have in params[0] ?

String

“String” is a type. I am asking what specific value it has.

the url for the file :
https://api.backendless.com/8ADB6090-B8EC-3E56-FFB0-CB0D68B7E000/v1/files/UserPhoto/Yaser00 photo

That URL is wrong - try opening it in a browser. You will get this message:

{“code”:6007,“message”:“The specified resource was not found”}

oh that right … but why is this happening ? this is the public url for the file … I get it from backendless console !

Read this please: https://backendless.com/feature-75-obtaining-files-public-url-for-files-in-file-storage/

I’ve read it … I am using the same method to get the public url from the backendless console

Can you attach a screenshot of Backendless console which shows the file in the directory? (I need to see the entire screen of the console)

ok please wait

that ?

Change the URL to put %20 where you have space:

https://api.backendless.com/8ADB6090-B8EC-3E56-FFB0-CB0D68B7E000/v1/files/UserPhoto/Yaser00%20photo

I will try

That didn’t work …the same error is showing !!

Try the code from the stackoverflow article I posted earlier.

ok I will try

already solved it by adding “.png” in the file name while uploading it … thanks