LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

file download with progress data?

Solved!
Go to solution

Hello,

I am looking for a way to download files from a known location but in a way to have a progress bar of the download. Is it possible?

I've started looking at DataSocket and the http GET vi and I managed to download some files from my Dropbox's Public folder (which has a link), but these VI's put my app in a hanging state until they finish downloading and I don't know how long it should take to finish, particularly if I would start downloading something bigger. 

Is there a VI anywhere which provides the progress data periodically? (Optionally speed would be nice as well, however I think, it should be calculated from the progress data and elapsed time.) I am planning to have an updater vi for an app of mine (I hate using USB sticks and copying it to the measurement PC following each update). I wouldn't really care for the progress data, if the files would be <1MB, however I have some bigger files which should take longer to download and a feel of the progress would make it bearable.

Thanks

__________________
Engage! using LV2015
0 Kudos
Message 1 of 9
(4,817 Views)
The ftp VIs maybe?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 9
(4,807 Views)

@mikeporter wrote:
The ftp VIs maybe?

This is how I've done it in the past.  I implemented a modified FTP API which took the NI one and added support for two progress bars, current file and File 1 of N, using a functional global.  Also I think my version added cancel support.  I started by opening up the NI VIs, and saving a new copy, with a new name, which still had the same low level VI calls NI already wrote.

Message 3 of 9
(4,716 Views)

Thank you guys, seems like I have to get myself into it and examine the ftp VIs. (Can these FTP vis accept http download as well?)

__________________
Engage! using LV2015
0 Kudos
Message 4 of 9
(4,707 Views)

@jeanlucpicard wrote:

Thank you guys, seems like I have to get myself into it and examine the ftp VIs. (Can these FTP vis accept http download as well?)


Of course not! FTP is a completely different (and much simpler) protocol than HTTP.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 9
(4,690 Views)

then I should take a look at the inside of the TCP or HTTP vis as well

__________________
Engage! using LV2015
0 Kudos
Message 6 of 9
(4,683 Views)
Solution
Accepted by topic author jeanlucpicard
Don't worry about http, it's a different protocol with a basic purpose that has very little to do with transferring files. FTP on the other hand is all about file transfers, it's what it does and it's all that it does.

Brian's suggestion is an excellent one. Take a look at the existing VIs and if they do what you need, fine. If not use them as a starting point to create VIs that provide the feedback you need. Just don't forget the initial step of:

"...opening up the NI VIs, and saving a new copy, with a new name..."

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 7 of 9
(4,655 Views)
Solution
Accepted by topic author jeanlucpicard

That's going to be a dead end unfortunately if you use the NI provided HTTP VIs. While the FTP Vis are implemented fully in LabVIEW, the HTTP functions are only simple wrappers that call into a shared library. There is not much to see in those VIs and nothing to change in the shared library.

 

Depending on how involved your HTTP communication is, it is however not necessarily difficult to implement something fairly trivial in LabVIEW alone. That is unless you want to support HTTPS, in that case you can forget it. HTTPS support fully implemented in LabVIEW is a complete nonsense.

 

For normal HTTP you might want to look at OpenG. I remember they used to have a VI, that worked although it was a little crude. Here is the path to the old CVS directory on sourceforge containing the VIs.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 8 of 9
(4,645 Views)

Okay, seems like I've made some progress with modding the FTP vis. (Copying them to a new location almost drove me nuts, but eventually managed it).

Thanks for guiding me into the right direction. Now I just have to ask the IT guys an ftp account for my files 🙂

 

(I implemented an FTP [SIZE] vi based on other command vis and included an FGV in this file and the TCP Read Stream for the file size and progress data)

__________________
Engage! using LV2015
0 Kudos
Message 9 of 9
(4,609 Views)