C# Uploading files via HTTP
is it possible开发者_运维知识库 to upload files to web page and then access file data on website using $_FILES['file'] in php?
Use the following code to send file name to php file as POST value and it also stores the returned value
WebClient client = new WebClient();
byte[] bret = client.UploadFile(webpath, "POST", filepath);
string sret = System.Text.Encoding.ASCII.GetString(bret);
You have to modify your webserver in some way to answer POST requests with the appropriate actions. If you can't acces your server, you can't upload to it with C#; there is no 'standard' way to do this.
精彩评论