Whats the best/easiest way to (synchronously) download a file from the internet?
Without ever getting a cached copy?
Re: Whats the best/easiest way to (synchronously) download a file from the internet?
use the URLDOWNLOADTOFILE API, and append a cahce-busting string to the end of the url:
where:
http://www.vbforums.com/showthread.php?t=458435
becomes:
http://www.vbforums.com/showthread.p...58435&jnk=3535
either use rnd to generate a random string, or use
timer*100
i believe there might be a way to prevent caches with an argument to the API call, but i don't know what it is.
vb Code:
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Public Function Url2File(URL As String, _
LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then Url2File = True
End Function
Re: Whats the best/easiest way to (synchronously) download a file from the internet?
Here is another manner using URLDownloadToFile and DeleteUrlCacheEntry:
http://vbnet.mvps.org/index.html?cod...ilenocache.htm