hhtp utils save file - clear cache

mc73

Well-Known Member
Licensed User
Now, I know there is httpUtils2 out there, but to me whatever works should not be abandoned easily, so I still use the httpUtils first version.
Here's a notice: When I call the 'save file' sub, everything works properly, but then I saw in my settings panel (applications) that there was always cache memory used. That was, either to downloading a new version of my app, or other files. I've checked the 'save file' sub and I put a delete command, in order to clear the downloaded file, which (I hope) is done after the file.copy procedure. My cache is clear again, so I thought I'd let anyone still using the httputils, know, about this thing. Here's the replacement:
B4X:
Sub SaveFile(URL As String, LocalPath As String,Fname As String)
    If IsSuccess(URL) = False Then
        'log("Task not completed successfully.")
    End If
    File.Copy(HttpUtilsService.TempFolder, SuccessfulUrls.Get(URL),LocalPath,Fname)
    File.Delete (HttpUtilsService.TempFolder,SuccessfulUrls.Get(URL))
End Sub
 
Top