03-17-2021 08:01 AM - edited 03-17-2021 08:16 AM
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?
Solved! Go to Solution.
03-22-2021 05:13 PM
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?
04-14-2021 09:52 AM
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.
02-06-2023 07:57 PM
Hi, Do you resolve your problem? I have the same problem.
03-29-2023 10:26 AM
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.
07-14-2023 09:57 AM
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
07-15-2023 11:50 AM
Thanks for that tip! Will give it a try.
12-11-2023 06:03 PM
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.
08-12-2024 05:31 AM
Although I accepted the explanation as a solution, it really is just an explanation, which includes a possible workaround. 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. I will attempt to report it as a bug to NI.