LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Webservice upload file post multipart error

Solved!
Go to solution

I am making a webservice with LV2020-32 and I have created a VI that serves a html form to a browser. The form markup uses POST and the form attribute enctype="multipart/form-data", which supposedly is required if you want to upload a file. The POST request is handled by another vi, but it never receives the file. If I call "Read Postdata.vi" I actually also get an error -67032 that states that the NI webservice does not support multipart bodies. This is not true, because "read all form data.vi" will accept the multipart body.  It will however not return any uploaded files.

 

Lastly, I tried the "Read uploaded files.vi", but it, too, never returns any uploaded files. It gave met error -67023 too: An operating system exception encountered.

 

I also tried "enable CORS for all origins" just to rule out that the browser is making a distinction in content based on mime-type.

I have checked the POST request made by the HTML form, which is completely fine.

 

Any ideas anyone?

------------------------------------------------------------------------------------
Seriously concerned about the Labview subscription model
0 Kudos
Message 1 of 8
(1,568 Views)

I wonder why there's not one response to my question so far. It seems like a fairly basic thing to do with a webserver. The webservice toolkit even has a VI to return the uploaded files. It really should be quite simple to upload a file through a webform. What am I missing?

------------------------------------------------------------------------------------
Seriously concerned about the Labview subscription model
0 Kudos
Message 2 of 8
(1,496 Views)

By adding a response myself, NI no longer got a trigger to provide support on this question. I am really surprised that there is no response at all on this question.

 

I did find out that behind the NI web server there is a basic install of Systemlink. Maybe the ability to upload files depends on settings inside Systemlink instead. However, I can't find any relevant documentation on this particular subject.

------------------------------------------------------------------------------------
Seriously concerned about the Labview subscription model
0 Kudos
Message 3 of 8
(1,451 Views)

Hi, Do you resolve your problem? I have the same problem.

0 Kudos
Message 4 of 8
(1,003 Views)

No, I have yet to resolve this issue. I decided to make a labview based client first. In labview, I am able to upload a file, simply as flattened base64 data in a simple POST. In HTML I may not have that option.

------------------------------------------------------------------------------------
Seriously concerned about the Labview subscription model
0 Kudos
Message 5 of 8
(892 Views)
Solution
Accepted by topic author aartjan

To any that find this:

 

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.

 

I used the VIs show here: https://forums.ni.com/t5/LabVIEW/Upload-file-with-LabVIEW-webservices/m-p/4100691#M1181323

 

EvanCo_0-1689346619664.png

 

0 Kudos
Message 6 of 8
(727 Views)

Thanks for that tip! Will give it a try.

------------------------------------------------------------------------------------
Seriously concerned about the Labview subscription model
0 Kudos
Message 7 of 8
(716 Views)

It was correct. I started Labview in admin mode and was able to receive the file (running the webservice in the project). Indeed, you must also move the file right away. As soon as the request is done, the file will disappear, too.

 

Very weird, though, that it has to run in admin mode. Also a shame one can't read the multipart body.

------------------------------------------------------------------------------------
Seriously concerned about the Labview subscription model
0 Kudos
Message 8 of 8
(384 Views)