Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

How to upload Image on server using ReactNative

$
0
0

I am setting headers and body , Using fetch with Post to upload image on server.I am getting the response code 200 but it is not uploading image but rest of the Data is getting uploaded.

Here is the code of body:

export default function setRequestBody(imagePath){    let boundry = "----WebKitFormBoundaryIOASRrUAgzuadr8l";    let body = new FormData();    body.append("--"+boundry+"\r\n");    body.append("Content-Disposition: form-data; name=imageCaption\r\n\r\n");    body.append("Caption"+"\r\n");    body.append("--"+boundry+"\r\n");    body.append("Content-Disposition: form-data; name=imageFormKey; filename =iimageName.pngg \r\n");    body.append("Content-Type: image/png \r\n\r\n");    body.append({uri : imagePath});    // appened image Data Here    body.append("\r\n");    body.append("--"+boundry+"--\r\n");    return body}

Please help.What mistake I am making. :(


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>