Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

uploading file

i have my website on one server now my page in this server have to upload the file into my freinds website server

the follwoing code is in the page which is present in my server

if

( ( File1.PostedFile != null ) && ( File1.PostedFile.ContentLength > 0 ) )
{

string fn = System.IO.Path.GetFileName(File1.PostedFile.FileName);

string SaveLocation = "http:\\www.myfriendserver.com\datafolder" + "\\" + fn;
File1.PostedFile.SaveAs(SaveLocation);

Response.Redirect("transfertosql.aspx");

}



the error what i get is



Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: URI formats are not supported.
[911 byte] By [syedwna] at [2007-11-11 10:21:24]
# 1 Re: uploading file
The error means that you cannot save a file to a URL; you must provide a file system path ("d:\path\filename" or "\\servername\sharename\filename").
Phil Weber at 2007-11-11 23:11:54 >
# 2 Re: uploading file
somebody said me to use httpwebrequest but how to use and does it solve the problem according to you.
syedwna at 2007-11-11 23:12:59 >
# 3 Re: uploading file
http://www.google.com/search?q=webrequest+upload+file
Phil Weber at 2007-11-11 23:13:58 >