-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: KashiMVP
Message 3 in Discussion


Hi Angshu/Pramod/sana

To upload file to web server you need to use webclient,
Here is the code for the same

Write a client like this

WebClient wc = new WebClient();
byte[] responseArray =
wc.UploadFile("http://kashinath/ProjectServerClient/WebForm2.aspx","POST
", @"C:\test\Source.txt");

// Decode and display the response.

MessageBox.Show("\nResponse Received.The contents of the file uploaded
are: \n " + Encoding.ASCII.GetString(responseArray));


Then create webform in your server to recv the file and save...

Code for web form is :

<%@ Page language="c#"%>
<%@ Import Namespace="System"%>
<%@ Import Namespace="System.IO"%>
<%@ Import Namespace="System.Net"%>
<%@ Import NameSpace="System.Web"%>

<Script language="C#" runat=server>
void Page_Load(object sender, EventArgs e) {
    
    foreach(string f in Request.Files.AllKeys) {
        HttpPostedFile file = Request.Files[f];
        file.SaveAs("c:\\test\\UploadedFiles\\" + file.FileName);
    }    
}

</Script>
<html>
<body>
<p> Upload complete.  </p>
</body>
</html>

If u get any issues... Call me 4060..  :)

Happy coding...!!!


-----Original Message-----
From: Angs [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 03, 2003 1:54 AM
To: BDOTNET
Subject: Anyone want to answer this


-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Angs
Message 1 in Discussion

  Hi Group,   Where are you all............. Can anyone please help.   I
want to upload files from C# windows program to a webserver(IIS) hosting
aspx page.   I am trying to use HttpWebRequest in System.Net namespace
but it is not working. Can you tell me how do i attach the file with the
request using HttpWebRequest and receive the file in the .aspx page.
Angs

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your
E-mail Settings. http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport
Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if
you received this message by mistake, please click the "Remove" link
below. On the pre-addressed e-mail message that opens, simply click
"Send". Your e-mail address will be deleted from this group's mailing
list. mailto:[EMAIL PROTECTED]



-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to