Sending file to server iOS with two parameters iOS

前端 未结 1 1054
耶瑟儿~
耶瑟儿~ 2021-01-26 02:02

I want to send file to server path with a paramater \"filepath\" as one parameter, and file data as another paramater. How do I do it.Here in the following I am appending filepa

相关标签:
1条回答
  • 2021-01-26 02:35

    You can't just do [body appendData:pathData]; at the start. You need to add it with the appropriate boundary and content information. So you should have a number of lines like:

    1. Add the boundary
    2. Add the content info
    3. Add the content data
    4. Add the boundary

    And repeat from 2 for each additional piece of data to be added.

    Check the spec for information on the appropriate content types and disposition info that needs to be added for each data type (perfect example for you is at the bottom).

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