Get File Attributes when Downloading Files

Bill Norris

Active Member
Licensed User
Longtime User
Am having problem with OutofMemory crash when downloading image files with httputils. The download goes fine, but when it gets to File.Copy2 line, if the file is around 2MB, program stops, and log shows outofmemory:

B4X:
Dim out As OutputStream
        out = File.OpenOutput(File.DirDefaultExternal,file_name,False)
        File.Copy2(HttpUtils.GetInputStream(link), out)
        out.Close

Am wondering if I can get file attributes of the files on the server, so I can only download smaller files, then I'll deal with the larger ones separately. BTW, I can download larger files individually with no problem.
 

Bill Norris

Active Member
Licensed User
Longtime User
RE:

Wouldn't you know it -- I got this error so many times, but now I cannot reproduce it -- everything comes across without issue. If happens again, I will reply as requested.
 
Upvote 0
Top