yaseralosh
(yaseralosh)
September 30, 2015, 2:42pm
1
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:
android, webserver, kml
Also, what value do you have in params[0] ?
“String” is a type. I am asking what specific value it has.
yaseralosh
(yaseralosh)
September 30, 2015, 3:25pm
5
That URL is wrong - try opening it in a browser. You will get this message:
{“code”:6007,“message”:“The specified resource was not found”}
yaseralosh
(yaseralosh)
September 30, 2015, 3:28pm
7
oh that right … but why is this happening ? this is the public url for the file … I get it from backendless console !
yaseralosh
(yaseralosh)
September 30, 2015, 3:34pm
9
I’ve read it … I am using the same method to get the public url from the backendless console
mark-piller
(Mark Piller)
September 30, 2015, 3:37pm
10
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)
mark-piller
(Mark Piller)
September 30, 2015, 3:45pm
13
yaseralosh
(yaseralosh)
October 1, 2015, 4:53pm
15
That didn’t work …the same error is showing !!
Try the code from the stackoverflow article I posted earlier.
yaseralosh
(yaseralosh)
October 2, 2015, 5:21pm
18
already solved it by adding “.png” in the file name while uploading it … thanks