473,325 Members | 2,774 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,325 software developers and data experts.

WebRequest Upload File

I have an html form that accepts a file for uploading, but I wanted to
create a program to automate the upload procedure.
I beileive you use the Webresponse class, but I was not sure how to use this
class to post a file to a specified website. In some documentation I have,
it also specifies the Request Header must be: Content-type:
application/octet-stream
here is the web site html code:

<form action=post method=post enctype=multipart/form-data> File to
post<input name="FileData" type="file" size="32"><input type=submit
value="Post file to mailbox"></form>

thanks for your help
Nov 16 '05 #1
4 9699
Shawn,

If you don't have to set cookies or anything of that nature, then you
could probably use the WebClient class to handle this. It will automate the
uploading of files to a server.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Shawn Mesiatowsky" <sh***@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have an html form that accepts a file for uploading, but I wanted to
create a program to automate the upload procedure.
I beileive you use the Webresponse class, but I was not sure how to use
this
class to post a file to a specified website. In some documentation I have,
it also specifies the Request Header must be: Content-type:
application/octet-stream
here is the web site html code:

<form action=post method=post enctype=multipart/form-data> File to
post<input name="FileData" type="file" size="32"><input type=submit
value="Post file to mailbox"></form>

thanks for your help

Nov 16 '05 #2
I thought the WebClient was used for uploading files to the webserver, such
as updating web pages, etc. But I need to pass the file to a server as a
post request, not just to put a file on a server. can the Webclient do this
as well?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:e8**************@TK2MSFTNGP14.phx.gbl...
Shawn,

If you don't have to set cookies or anything of that nature, then you
could probably use the WebClient class to handle this. It will automate the uploading of files to a server.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Shawn Mesiatowsky" <sh***@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have an html form that accepts a file for uploading, but I wanted to
create a program to automate the upload procedure.
I beileive you use the Webresponse class, but I was not sure how to use
this
class to post a file to a specified website. In some documentation I have, it also specifies the Request Header must be: Content-type:
application/octet-stream
here is the web site html code:

<form action=post method=post enctype=multipart/form-data> File to
post<input name="FileData" type="file" size="32"><input type=submit
value="Post file to mailbox"></form>

thanks for your help


Nov 16 '05 #3
Shawn,

Yes, it will. Check out the UploadFile method on the WebClient class.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Shawn Mesiatowsky" <sh***@nospam.com> wrote in message
news:eZ**************@tk2msftngp13.phx.gbl...
I thought the WebClient was used for uploading files to the webserver, such
as updating web pages, etc. But I need to pass the file to a server as a
post request, not just to put a file on a server. can the Webclient do
this
as well?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in
message news:e8**************@TK2MSFTNGP14.phx.gbl...
Shawn,

If you don't have to set cookies or anything of that nature, then you
could probably use the WebClient class to handle this. It will automate

the
uploading of files to a server.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Shawn Mesiatowsky" <sh***@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
>I have an html form that accepts a file for uploading, but I wanted to
> create a program to automate the upload procedure.
> I beileive you use the Webresponse class, but I was not sure how to use
> this
> class to post a file to a specified website. In some documentation I have, > it also specifies the Request Header must be: Content-type:
> application/octet-stream
> here is the web site html code:
>
> <form action=post method=post enctype=multipart/form-data> File to
> post<input name="FileData" type="file" size="32"><input type=submit
> value="Post file to mailbox"></form>
>
> thanks for your help
>
>



Nov 16 '05 #4
The UploadFile method requires 2 parameters, the first being the location of
the file location you are trying to upload. Do i just specify the webpage
file that the form posts to?
for instance, if I have a form on a server in form.html:
<form action="post.aspx">
then do I specify the uri like this: http://www.company.com/post.aspx

I had just assumed that the first parameter was for uploading a file you
want to store on a server, for instance,

If I had edited index.html and wanted to upload the page to
www.company.com/index.html then I would use the webclient.

Am I wrong on this? the reason I just do not test is because it is a third
party that is hosting the site, and I have no facility for testing, unless a
create some web app myself that accepts files. Thanks for your help so far
Nicholas.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ep**************@TK2MSFTNGP12.phx.gbl...
Shawn,

Yes, it will. Check out the UploadFile method on the WebClient class.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Shawn Mesiatowsky" <sh***@nospam.com> wrote in message
news:eZ**************@tk2msftngp13.phx.gbl...
I thought the WebClient was used for uploading files to the webserver, such as updating web pages, etc. But I need to pass the file to a server as a
post request, not just to put a file on a server. can the Webclient do
this
as well?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in
message news:e8**************@TK2MSFTNGP14.phx.gbl...
Shawn,

If you don't have to set cookies or anything of that nature, then you could probably use the WebClient class to handle this. It will automate
the
uploading of files to a server.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Shawn Mesiatowsky" <sh***@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
>I have an html form that accepts a file for uploading, but I wanted to
> create a program to automate the upload procedure.
> I beileive you use the Webresponse class, but I was not sure how to

use > this
> class to post a file to a specified website. In some documentation I

have,
> it also specifies the Request Header must be: Content-type:
> application/octet-stream
> here is the web site html code:
>
> <form action=post method=post enctype=multipart/form-data> File to
> post<input name="FileData" type="file" size="32"><input type=submit
> value="Post file to mailbox"></form>
>
> thanks for your help
>
>



Nov 16 '05 #5

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

Similar topics

1
by: Katie | last post by:
I am attempting to write an Ftp Client to send a quote command prior to a file upload. I would like to use the WinInet.dll but it seems to hang when I call the FtpCommand method from C# or it...
1
by: umeshayk | last post by:
Respected Sir What ever you have explained on WebRequest and WebResponse I came to know very well.I started to implement a project based on this concept.What i did was 1. I used Webrequest to...
8
by: John K. | last post by:
Hi I was wondering if it's possible to use the WebRequest class to access a file on windows shared folder with authentication? If yes, what would the syntax be? I've tried to look this up in the...
4
by: Terry | last post by:
Hello, I am trying to get a response for an .aspx page in my current project (same virtual directory) by using WebRequest.GetResponse but I keep getting a exception with "500 Internal server...
2
by: kkb | last post by:
Hello! First, I'm sorry because of my english... I'll try to be understandable! I've got a strange problem using .NET 2003 C# and I haven't figured it out for a long time. I'm implementing an...
2
by: SharpCoderMP | last post by:
I'm having troubles with uploading files to the ftp server using FtpWebRequest. I occasionally get an Exception saying: "The underlying connection was closed: An unexpected error occurred on a...
4
by: RobAMacAF | last post by:
I am using this... string url = "http://digi-wiz.com/uploads/upload/Nouns"; string result = null; WebClient client = new WebClient(); result = client.DownloadString( url );...
4
by: CindyH | last post by:
Hi I'm trying to use webrequest - webresponse to post a stream. I have set up a simple test with one aspx form holding the post code and trying to get another aspx form to receive the post on...
2
by: Piotrekk | last post by:
Hi I am trying to upload a 700 mb file using webrequest/response model. At 3x% I am getting the same error: "Unable to write data to the transport connection: an established connection was...
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: 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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.