Upload multiple files in a single HTTPWebRequest

后端 未结 2 1517
清歌不尽
清歌不尽 2020-12-19 11:06

I have created a service which accept 2 things :

1) A body parameter called \"type\".

2) A csv file to be uploaded.

i am reading this two things in s

相关标签:
2条回答
  • 2020-12-19 11:32

    The code you have above does not create a proper multipart body.

    You can't simply write the file into the stream, each part requires a preamble boundary marker with per-part headers, etc.

    See Upload files with HTTPWebrequest (multipart/form-data)

    0 讨论(0)
  • 2020-12-19 11:34

    Some informations about your multiple contentTypes problem here : http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.2

    multipart/form-data is the only way to send multiples data types over http protocol.

    0 讨论(0)
提交回复
热议问题