Using HttpWebRequest to POST data/upload image using multipart/form-data

前端 未结 3 718
情歌与酒
情歌与酒 2020-12-03 03:20

I am trying to use the ImageShack API to upload images. To use it, I am supposed to POST the image using multipart/form-data. I did it like ...

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 03:54

    This is nothing like multipart/form-data

    1. There's no boundaries between fields (needed even with one field).
    2. Why are you base-64 encoding?
    3. There's no indication of the content-type of the image.

    Take a look at RFC 2388 for the actual format spec. It can also be useful to look at a Fiddler grab of a file upload from a web-page.

提交回复
热议问题