美文网首页
http: media-type:multipart / for

http: media-type:multipart / for

作者: BenjaminCool | 来源:发表于2018-12-28 19:30 被阅读3次

    https://stackoverflow.com/questions/4526273/what-does-enctype-multipart-form-data-mean/28380690#28380690

    1. 如果表单包含文件上传,则使用multipart / form-data,否则使用application / x-www-form-urlencoded,如果省略enctype,则默认为默认值。

    So after that initial set of headers follows the request body

    https://ec.haxx.se/http-multipart.html

    --------------------------d74496d66958873e
    Content-Disposition: form-data; name="person"

    anonymous
    --------------------------d74496d66958873e
    Content-Disposition: form-data; name="secret"; filename="file.txt"
    Content-Type: text/plain

    contents of the file
    --------------------------d74496d66958873e--

    3. 如何读取请求body:

    https://stackoverflow.com/questions/9081079/rest-http-post-multipart-with-json

    --HereGoes
    Content-Disposition: form-data; name="myJsonString"
    Content-Type: application/json
    
    {"foo": "bar"}
    --HereGoes
    Content-Disposition: form-data; name="photo"
    Content-Type: image/jpeg
    Content-Transfer-Encoding: base64
    
    <...JPEG content in base64...>
    --HereGoes--
    
    
    

    4. 上传多张图片

    https://hellokoding.com/uploading-multiple-files-example-with-spring-boot/

    5. 上传多张图片和json

    https://www.mkyong.com/spring-boot/spring-boot-file-upload-example-ajax-and-rest/

    相关文章

      网友评论

          本文标题:http: media-type:multipart / for

          本文链接:https://www.haomeiwen.com/subject/ixielqtx.html