Sarah Phil
Sarah Phil

Reputation: 263

Image download from server URL android

For now, i am able to download the image that i uploaded into my server. My upload is using php script to file open a image to store the .jpg file in the server. But i want to know how to retrieve the new image from my server to my android application. What i meant is every time the user upload the image, the image will replaced the old image file (using the same file name) in my server folder.

When i reload the image in my application, it still gives me the old image even though the image not longer exist. Later i found out that i need to go the url and refresh the image then the new image will be loaded in the android application. I want to know how can i refresh the url without using the browser to refresh the image every time the user upload new image. Thanks!

My question might not be clear/good but i really needed help and im new to android development

Upvotes: 1

Views: 671

Answers (2)

mukesh
mukesh

Reputation: 4140

After successfully replaced on server,you have to get url of new uploaded image as response & replace old url by new url.

Upvotes: 0

Bart Blommaerts
Bart Blommaerts

Reputation: 821

A pragmatic approach: When the user uploads a file, also make a txt/xml-file with the current date in it.

Make you Android application poll the txt/xml-file. Store the date in the txt/xml-file (in a database). When polling verify if the date in the file is newer then the one you stored. If it's newer, download your image.

Upvotes: 1

Related Questions