Any method to upload file via POST?

B

Brett

Does any one have examples of how to upload a file via POST and also include
other form fields? Say two input boxes and a file type input.

I've tried:
WebRequest.Create()
and
System.Web.HttpUtility.UploadFile()

Neither provide seperation boundaries and that seems to fail the operation.
I am using "POST" for the method type.

Additionally, my header will come through like this:
Content-Disposition: form-data; name="file"; filename="something.csv"
Content-Type: application/octet-stream

When done through the web browser, it looks like this:
Content-Disposition: form-data; name="csvFile";
filename="C:\myFiles\something.csv"
Content-Type: application/octet-stream

I also changed the script that accepts the form to take in a field named
"file". Upload still didn't work. Anyway, any one that has uploaded a file
via POST, I'd appreciate an example.

Perhaps just sending HTML (with FORM tags) to the web server will work. I'd
like rather the above methods however.

Thanks,
Brett
 
G

gaidar

Hi, Brett,

Use multipart/form-data encoding type.
In form tag it looks like:
<form method="post" enctype="multipart/form-data">

Best regards,
Gaidar
 
B

Brett

I am. No change.

Thanks,
Brett

gaidar said:
Hi, Brett,

Use multipart/form-data encoding type.
In form tag it looks like:
<form method="post" enctype="multipart/form-data">

Best regards,
Gaidar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top