0

I want to upload a file using a restwebservice. I am able to do it using webclient, but I want to do it using httpwebrequest. As, I suspect webclient is very slow. So, how to post a file to a server using httpwebrequest webservice.

Ian
  • 30,182
  • 19
  • 69
  • 107
V K
  • 1,645
  • 3
  • 26
  • 57
  • 3
    Possible duplicate of [Upload files with HTTPWebrequest (multipart/form-data)](http://stackoverflow.com/questions/566462/upload-files-with-httpwebrequest-multipart-form-data) – Sujeet Sinha May 19 '16 at 11:34
  • you can refer this link to solve you questions. http://stackoverflow.com/questions/566462/upload-files-with-httpwebrequest-multipart-form-data – anshul gupta May 19 '16 at 11:36
  • Why do you suspect "webclient is very slow"? It's in fact, just a wrapper around HttpWebRequest. – derpirscher May 19 '16 at 12:33
  • I have two types of webservices to upload file.In one, I convert the meta data alongwith the file data to base64 string and post it to the server.In the other, I send the meta data as headers and send the file using uploadfileasync.The first(using webrequest) webservice is twice as fast as second for uploading 2 MB file.The speed is almost same for 200 KB file. – V K May 20 '16 at 04:28

0 Answers0