LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Upload file with LabVIEW webservices

Solved!
Go to solution

Hi Community,

 

I running a PC based webservice and I'd like my users to be able to log in to the website (done), select the upload menu (done), select the file they want to upload (done), then using a POST method I need a routine which acutally uploads the file to the server (not done) all from their browser. I have found several links demonstrating how the client can upload a file from labview, but my clients dont have labview. All need to be done via their browser.

 

I have attached my solution how the server can send a file to the user. This part is working, but I need a file transfer to the opposite way as well.

 

Thanks!

 

 

 

Server_to_client.png

0 Kudos
Message 1 of 8
(6,201 Views)
Solution
Accepted by topic author 1984

Use 'read uploaded files info' from the Web Services palette. It will allow you to access files that that you upload from a html form in your web service. It will give you a temporary file path which you can then open/copy.


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 2 of 8
(6,188 Views)

Thanks mate, I never thought that its gonna be this easy! (can you check my response to the other webservice related question: http://forums.ni.com/t5/LabVIEW/Webservice-to-EXE/m-p/3171378#M916020)

 

 

0 Kudos
Message 3 of 8
(6,166 Views)

Hello all, I replicated the above VI.  I want the web service server to send a text file to the client.  The client side downloads the file but the file is empty.  Attached is the block diagram probing the text file showing there is data. Any help would be appreciated.

 

WSTextFile.png

0 Kudos
Message 4 of 8
(5,348 Views)

The problem is solved by going to web Service properties and changing the setting from Terminal to Stream.  See pic.Screen Shot 2018-01-18 at 7.57.51 PM.png

Message 5 of 8
(5,338 Views)

Sir/Madam,

 

I tried to upload multiple files using attached project but only last file is coming as output in uploaded files (at the "read uploaded files info" VI), even upload for all files are successful in temporary folder. 

References: https://zone.ni.com/reference/en-XX/help/371361R-01/lvconcepts/ws_upload_files/

https://www.taniarascia.com/how-to-upload-files-to-a-server-with-plain-javascript-and-php/

 

Thanks

Download All
0 Kudos
Message 6 of 8
(3,688 Views)

I was having the same issue, and the only way I got it to work was to run the built exe as an administrator.  If I ran it directly from LabVIEW I get error: "-67032".  Note, I also added the error cluster to the terminals to make it easier to see the issue.

0 Kudos
Message 7 of 8
(1,529 Views)

I just figured out what the root cause is of the issue: The temporary upload file is written to C:\ProgramData\National Instruments\WebServices\amqp_temp

This folder requires admin rights, and therefore the app fails when not running in admin mode.

0 Kudos
Message 8 of 8
(251 Views)