天天看点

C#高级编程第三版--31.1.3上传文件

31.1.3  上传文件

WebClient client = new WebClient();

 

 client.UploadFile("http://www.ourwebsite.com/NewFile.htm",

 

                   "C://WebSiteFiles//NewFile.htm");

 

 byte [] image;

 

 // code to initialise image so it contains all the binary data for

 

 // some jpg file

 

 client.UploadData("http://www.ourwebsite.com/NewFile.jpg", image);