LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to POST Multipart/Form-Data to ASP?

I need to POST data via HTTP to an ASP page. The data is small text files about 1.2 K in size. I’m using the TCP primitives to open a connection to the web site, and transmit what I think is the POST data, but the site will not recognize the transmission as a valid data file. After the POST attempt, I can read the contents of the site through another .ASP page and see that the data is not there.

I know that the upload ASP page works because we have a web page that can be used to manually upload files. Here’s a snippet of HTML that will transmit the data successfully:

<form enctype="multipart/form-data" method="post" action="upload_action.asp?dir=files">
<input type="file" name="file1" size=50>

I need to either structure a POST header in terms of Content-Type, Content-Disposition, etc, or find a way to replicate this action through ActiveX. I chose to work with the TCP primitives because I want this action to be invisible to my users. I'd like to make this method work, but I need to get this done quickly. I've tried to find the solution through our web developer, but I think that .ASP and Labview are so far removed, that he doesn't understand what I'm looking for. Any help would be appreciated.

Regards,

Phil Blaze
0 Kudos
Message 1 of 3
(4,186 Views)
Well I figured it out. Not really sure if anyone is interested, but here's a description.

I took the above HTML, editted the "action= " portion of the Form statement to point to my own IP address on a specific port. Then added a submit button with this line:

<input type="submit" value="Upload Files">

Then put that whole mess into an HTML document which I opened in a web browser.

Next I threw together a little vi to listen on the specified port. I then read the TCP transmission that resulted when I operated the page on the browser. The resulting text showed me the format of the raw HTTP I needed to upload my file. It works.

This is a limited case for posting multipart/form-data, but I think the method would be useful to anyone trying to embed web functions into Labview software.
0 Kudos
Message 2 of 3
(4,174 Views)

It has been years from this post.

And I have been searching around without any new info on this topic.

 

Poor days~

0 Kudos
Message 3 of 3
(3,773 Views)