Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URLDownloadToFile Anomaly 1

Status
Not open for further replies.

Error7

Programmer
Jul 5, 2002
656
0
16
GB
I have been using the URLDownloadToFile very successfully to download jpg images from traffic cameras in the USA and Canada. However, I have more recently been downloading images from cameras in Kansas but I've found that the jpg images never refresh. If I use the same URL in a browser then the images refresh every 10 minutes or so. I don't understand what's wrong or how to fix it.

This is an example of a url:
Alan

[gray]Experience is something you don't get until just after you need it.[/gray]
 
I ran in to a similar issue with one of my apps. The problem is caused by cacheing. Since the URL of the image hasn't changed, your machine thinks it already has the image and therefore loads it from your local disk (in a temp storage location) instead of re-downloading it.

I solved my issue by adding a query string parameter, like this:

Url = YourUrl & "?d=" & Format(Now, "yyyymmddhhnnss")

This will make the url look something like this:

[ignore]
[/ignore]

The website will ignore the d parameter simply because it isn't used, and your download will work because it thinks it is loading a different page.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
You can also toss all of that crud and just use the AsyncRead method built into VB6. The option flag vbAsyncReadForceUpdate offers a way to bypass your local UrlMon/WinInet cache with trivial effort.
 
Thanks George. I'll have a go with your suggestion as it looks easier for me to implement into my existing code.


[gray]Experience is something you don't get until just after you need it.[/gray]
 
Thanks George, that worked a treat.

[gray]Experience is something you don't get until just after you need it.[/gray]
 
I wasn't that thirsty [stpatrick2]

[gray]Experience is something you don't get until just after you need it.[/gray]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top