0

Im looking for solution how can I upload some file using http request. I got the idea that I'll transfer my files by post and on PHP side I'll put files on the server.

How doin this?

3 Answers 3

1
var client = new System.Net.WebClient();
client.UploadFile(address, filename);

See UploadFile on MSDN.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, but how's called post field?
0

Well I'd try the simplest possible thing that might work to start with - WebClient.UploadFile:

WebClient client = new WebClient();
client.UploadFile(url, file);

Of course, you'll have to write appropriate PHP code to handle the upload...

Comments

0

One more approach is to upload file via browser and handle upload request/response with Fiddler. After that, you can write exact request using HttpWebRequest via C#.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.