Hi all! I have a problem saving a file downloaded from Internet. If file already exists in the folder, file is added instead of rewrite it (for example if I download example.jpg that has 12kb, and then try downloading again in the same place, now example has 24kb).
This is code I'm using:
Any idea? Thanks!!
This is code I'm using:
B4X:
Sub JobDone (Job As String)
If HttpUtils.IsSuccess(fileurl&filename) Then
Dim out As OutputStream
out = File.OpenOutput(fd.FilePath,filename, True)
File.Copy2(HttpUtils.GetInputStream(fileurl&filename), out)
out.Close
ProgressDialogHide
ToastMessageShow(filename&" downloaded OK!", False)
End If
End Sub
Any idea? Thanks!!