I need to download a jpg from an online source to the Files folder of an app, and have been using this code:
However, there's something wrong here and I don't know what; the picture does indeed load to the appropriate location, but shows up as faulty (although I can see it with a viewer!) and the app denies its existence.
I've done similar things to this before with no problems, but am clearly doing something wrong this time! But what?
Thanks! John
B4X:
If HttpUtils.IsSuccess(Dlfilename) Then
In = HttpUtils.GetInputStream(Dlfilename)
Out = File.OpenOutput(File.DirDefaultExternal, Datafile, False)
File.copy2(In,Out )
Out.Flush
Out.Close
ToastMessageShow("Picture downloaded OK!", False)
Else
ToastMessageShow("Problem downloading picture!", False)
End If
However, there's something wrong here and I don't know what; the picture does indeed load to the appropriate location, but shows up as faulty (although I can see it with a viewer!) and the app denies its existence.
I've done similar things to this before with no problems, but am clearly doing something wrong this time! But what?
Thanks! John
Last edited: