|
Post by pablosl on Jul 19, 2023 23:32:52 GMT -5
I would like to download a file from internet (Google Drive?) but showing a progress bar, so user can see what's going on under the hood.
Thank you in advance.
-Pablo
|
|
|
Post by Rod on Jul 20, 2023 1:04:03 GMT -5
|
|
|
Post by pablosl on Jul 20, 2023 10:03:57 GMT -5
Rod: Thank you very much!. I will see what I can do.
Regards,
-Pablo
|
|
|
Post by pablosl on Jul 20, 2023 11:00:13 GMT -5
hmm. I have this code:
result = DownloadToFile("http://www.libertybasic.com/index.html", DefaultDir$ + "\test.htm")
Function DownloadToFile(urlfile$, localfile$) open "URLmon" for dll as #url calldll #url, "URLDownloadToFileA",_ 0 as long,_ 'null urlfile$ as ptr,_ 'url to download localfile$ as ptr,_ 'save file name 0 as long,_ 'reserved, must be 0 0 as long,_ 'callback address, can be 0 DownloadToFile as ulong '0=success close #url end function
BUT this function DownloadToFile returns 0 if success. So it only tell me if the file was downloaded or not .
Now, how do I find what percentage the file have been downloaded in megabytes?.
- Pablo
|
|
|
Post by Rod on Jul 20, 2023 11:37:52 GMT -5
The LBPE article downloads in chunks, which paces the download. This you can measure progress. To be honest a download progress bar is a bit superfluous given I can download at 250gb most of your users will never see the progress bar.
|
|
|
Post by xxgeek on Jul 20, 2023 12:06:19 GMT -5
An alternative if you wish. Works on Win 10+ Save to it's own folder before RUNing The download should be in the same dir.
Rod is correct. Unless the file being downloaded is huge, all you will see for progress is a flash. Try downloading the default Linux Mint ISO, and see the progress. Then comment the ISO and uncomment your file and see the progress difference. Just replace the link with whatever link you wish.
nomainwin q$=chr$(34) 'file$ = "http://www.libertybasic.com/index.html" file$ = "https://mirror.csclub.uwaterloo.ca/linuxmint/stable/21.2/linuxmint-21.2-cinnamon-64bit.iso" 'result = DownloadToFile("http://www.libertybasic.com/index.html", DefaultDir$ + "\test.htm") run "curl -O ";q$;file$;q$
'Function DownloadToFile(urlfile$, localfile$) ' open "URLmon" for dll as #url ' calldll #url, "URLDownloadToFileA",_ ' 0 as long,_ 'null ' urlfile$ as ptr,_ 'url to download ' localfile$ as ptr,_ 'save file name '0 as long,_ 'reserved, must be 0 ' 0 as long,_ 'callback address, can be 0 ' DownloadToFile as ulong '0=success ' close #url 'end function end
|
|
|
Post by pablosl on Jul 20, 2023 13:49:21 GMT -5
My connection should be very slow, because it takes 30 minutes to download linux mint?
|
|
|
Post by xxgeek on Jul 20, 2023 21:43:58 GMT -5
The Linux Mint ISO file is 2.88 gigabytes.
It took about 6 minutes here on a fairly slow connection in todays standards. You can see as it downloads the " current speed" among other details. The current speed here was fluctuating from around 8000 down to 2000 kilobytes a second.
Did the index file downloaded with a flash? Text files like that index.htm file are just a few kilobytes and should download quick.
|
|