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=multipa rt/form-data> File to
post<input name="FileData" type="file" size="32"><inpu t type=submit
value="Post file to mailbox"></form>
thanks for your help 4 9711
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.co m
"Shawn Mesiatowsky" <sh***@nospam.c om> wrote in message
news:%2******** ********@TK2MSF TNGP10.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=multipa rt/form-data> File to post<input name="FileData" type="file" size="32"><inpu t type=submit value="Post file to mailbox"></form>
thanks for your help
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.c om> wrote in
message news:e8******** ******@TK2MSFTN GP14.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.co m
"Shawn Mesiatowsky" <sh***@nospam.c om> wrote in message news:%2******** ********@TK2MSF TNGP10.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=multipa rt/form-data> File to post<input name="FileData" type="file" size="32"><inpu t type=submit value="Post file to mailbox"></form>
thanks for your help
Shawn,
Yes, it will. Check out the UploadFile method on the WebClient class.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Shawn Mesiatowsky" <sh***@nospam.c om> wrote in message
news:eZ******** ******@tk2msftn gp13.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.c om> wrote in message news:e8******** ******@TK2MSFTN GP14.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.co m
"Shawn Mesiatowsky" <sh***@nospam.c om> wrote in message news:%2******** ********@TK2MSF TNGP10.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=multipa rt/form-data> File to > post<input name="FileData" type="file" size="32"><inpu t type=submit > value="Post file to mailbox"></form> > > thanks for your help > >
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.as px">
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.c om> wrote in
message news:ep******** ******@TK2MSFTN GP12.phx.gbl... Shawn,
Yes, it will. Check out the UploadFile method on the WebClient class.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Shawn Mesiatowsky" <sh***@nospam.c om> wrote in message news:eZ******** ******@tk2msftn gp13.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.c om> wrote in message news:e8******** ******@TK2MSFTN GP14.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.co m
"Shawn Mesiatowsky" <sh***@nospam.c om> wrote in message news:%2******** ********@TK2MSF TNGP10.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=multipa rt/form-data> File to > post<input name="FileData" type="file" size="32"><inpu t type=submit > value="Post file to mailbox"></form> > > thanks for your help > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 returns a false response
even though the command was successful.
I have also attempted to inherit from the WebRequest and
WebResponse classes based on examples I have found on the
internet but it hangs when the socket goes to read
whether the...
|
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 hit the starting page of the website to get the Cookie value(www.ichotelsgroup.com)
(I am getting Cookie Value = "JSESSIONID=Q1FXQVIIYWOVPLAQ5U0SJ0VMCD4VOIY4 ; domain=.ichotelsgroup.com; path=/")
2.Then I used WebClient to upload values to Next...
|
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 references available but to no avail
Also, is it safer (better practise) in an LAN environment to use HTTP requests to access shared files (via ASP.NET) rather than UNC file shares
TIA
Regards
John
|
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 error" in the exception message.
I am able to do this fine with another .aspx page that has no code-behind.
The page that has code-behind throws the exception.
What I am doing is getting the .aspx response, reading the stream, replacing
|
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 application to download images
using System.NET classes (webclient, webrequest) asynchronously behind
proxy server. The reading method works like this:
System.Net.WebClient client=new System.Net.WebClient();
| |
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 receive". but
what's wired i get this exception just after upload is finished when i
try to close the stream that was used for upload. this happens only when
upload takes more that certain amount of time. note that upload itself
goes smooth no matter...
|
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 );
MessageBox.Show(result);
Which is very basic code. It just looks at the files in the http://digi-wiz.com/uploads/upload/Nouns
|
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 localhost.
Can you explain to me the possible reasons why a 'GetResponse' - to send the
data to a server might not be working for a simple text file with one line.
test.text - contains: this is a test.
|
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 aborted by the software in your host machine"
CLIENT side script is:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |