473,320 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Any method to upload file via POST?

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
Nov 21 '05 #1
2 1703
Hi, Brett,

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

Best regards,
Gaidar
"Brett" <no@spam.com> wrote in message
news:ue*************@TK2MSFTNGP15.phx.gbl...
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

Nov 21 '05 #2
I am. No change.

Thanks,
Brett

"gaidar" <ga****@vbstreets.ru> wrote in message
news:eG**************@TK2MSFTNGP10.phx.gbl...
Hi, Brett,

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

Best regards,
Gaidar
"Brett" <no@spam.com> wrote in message
news:ue*************@TK2MSFTNGP15.phx.gbl...
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


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pedro Carvalho | last post by:
I am using a WebClient.Upload File method (using the HTTP POST) on the Client side and, to accept posted files on the Server side, I am using an ASP.NET page with the following code: void...
0
by: Emil | last post by:
I am looking for a HTTP Client library for C++ that I can use to upload files by using the POST method to a PHP-script on my server. I am currently using QT's QHttp but I cant seem to get file...
4
by: Evgeny Zoldin | last post by:
Hi ALL. I would like to download file from some web-server that requires Basic-Authetication, change somthing in the file and upload it back to the server. I can download the file and proceed...
3
by: sushi | last post by:
Hello, I am trying to use WebClient class's UploadData method for uploading data to a particular uri. I ahve created a text file say new.txt in the IISROOT folder. But when I try to upload data to...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
2
by: Event Horizon | last post by:
Hi, I'm trying to add an simple upload applet to shopping cart script. My new applet form sends all needed post fields ( quantity, product, etc... ) but the "file" post field is hardcoded in...
0
Fary4u
by: Fary4u | last post by:
Hi Guys i'm trying to upload a file, i've tried 3 different methods but still not work out i don't know how to over come this problem hidden file value, multiple form or popup uploading. 1-...
5
by: Bob Bedford | last post by:
Hi all, I've to accept a file that is sent using a POST method. The file will be sent using this URL: http://username:pass@www.mysite.com/upload.php How can I retrieve the username and...
3
by: shapper | last post by:
Hello, I need to upload a file. Can I only do this with the File Upload control? I also need the following: - Send upload info, upload percentage, continuously to a JavaScript function so...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.