How to post multipart/formdata using fetch in react-native?

后端 未结 3 1511
醉梦人生
醉梦人生 2021-02-09 14:21

\"reference

i want to post Form Data like that.

what should i prepare for sending ima

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-09 14:49

    You need to create an instance of FormData and pass that as the body to fetch, like so:

    const data = new FormData()
    data.append("something", something)
    
    fetch(url, { method: 'POST', body: form })
    

提交回复
热议问题