1

I'm using the following code to upload a file:

WebClient w = new WebClient();
            byte [] res=w.UploadFile("http://gate.com/in.php", @"c:\image.gif");

How can I add additional post data like name=test&value=test2?

2 Answers 2

3

This is not supported by the WebClient class. You may take a look at a blog post I wrote on this topic. You could also upload multiple files with the presented solution.

2

Well, you could always send it in the querystring, like: "http://gate.com/in.php?name=test&value=test2"

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.