1。 发起端:
WebClient myWebClient = new WebClient();
string path = Request.Url.ToString();
path = path.Substring(0,path.LastIndexOf(@"/")+1);
path = path + @"UpLoadFile.aspx";
byte[] responseArray = myWebClient.UploadFile(path,"POST",@"d:\MyGod.txt");
2。接受端
void Page_Load(object sender, EventArgs e)
{ foreach(string f in Request.Files.AllKeys)
{
HttpPostedFile file = Request.Files[f]; file.SaveAs(@"c:\" + file.FileName);
}
}