Android Question Problem downloading a file

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
Hi,
Im using job1.download to download a file, works ok, but if I go to the server and change the contents of the file I allways get the previous file and not the new one.
Its like the file were cached.
How can I solve this?
Thanks
 

Douglas Farias

Expert
Licensed User
Longtime User
try add ?r="&r
B4X:
Dim r As Int = Rnd(0,999999)
links.Put(imgn1, "http://10.10.10.10/MeuPerfil/NaoEnviadas/"&"0.jpg?r="&r)
 
Upvote 0

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
First read is direct, I simpy do:
B4X:
job1.Download("http://pedidos.pqllana.com.ar/uploads/listaprecios.txt")
and in the
B4X:
job1.getstring()
I get the data inside the .txt file

Second is a full download and Im using:
B4X:
Sub bForzarLectura_Click
    Dim job As HttpJob
    job.Initialize("j", Me)
    job.Download("http://pedidos.pqllana.com.ar/uploads/preciosxprodenvbase.csv")
End Sub   

Sub JobDone(job As HttpJob)
   If job.Success Then
     Dim out As OutputStream = File.OpenOutput(File.DirDefaultExternal, "preciosxprodenvbase.csv", False)
     File.Copy2(job.GetInputStream, out)
     out.Close '<------ very important
   Else
     Msgbox("Error: " & job.ErrorMessage,"")
   End If
   job.Release
End Sub

In both cases I get the old file and not the new one.
Thanks
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
your code its correct, tested on my server and its ok.
some problem on your server/vps/host try reboot
 
Upvote 0

Alberto Michelis

Well-Known Member
Licensed User
Longtime User
reboot what? the server? this is almost impossible...
in some place this files are cached, how can I clear that chache?
 
Upvote 0
Top