Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Grab URL from net to file
#4
(11-07-2023, 03:12 PM)SMcNeill Wrote: One thing you need to watch out for is corrupting your data file.

      Open Urlfile$ For Binary As #filehandle  <-- This is where you open your file.

Before that line, add this one:        Open Urlfile$ For OUTPUT As #filehandle: CLOSE #filehandle

As it exists, you could have the file already on the drive (lets say at 100,000 bytes of data), and then you choose not to erase it.  When you download the new version of the file, it's only 96,000 bytes in size -- so it'll overwrite those first 96,000 bytes and then leave the rest unchanged.  You need to blank that file before writing to it, or else you're just asking for trouble in the future with left over data.

Oh, yeah. In my opinion, I'd just check if the file exists first then prompt to either kill it and proceed or just not download it. Or, you could even go as far as to make it autoincrement the name so you don't have naming conflicts. Like "file1.jpg(1)" "file1.jpg(2)" and so on and so forth.
Tread on those who tread on you

Reply


Messages In This Thread
Grab URL from net to file - by eoredson - 11-07-2023, 07:39 AM
RE: Grab URL from net to file - by SMcNeill - 11-07-2023, 03:12 PM
RE: Grab URL from net to file - by SpriggsySpriggs - 11-07-2023, 05:06 PM
RE: Grab URL from net to file - by eoredson - 11-08-2023, 12:11 AM



Users browsing this thread: 1 Guest(s)