Any method to upload file via POST?

  • Thread starter Thread starter Brett
  • Start date Start date
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
 
Hi, Brett,

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

Best regards,
Gaidar
 
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
 
Back
Top