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

Image not Uploading via axios in React Native while running On IOS

$
0
0

Currently I am stuck in a problem, which i am not able to solve, i hope some one help.

I have made a react native application in which i have used react-native-image-picker package to upload the image to the server.

The image uploading works fine on android but whenever i try to upload the image via IOS emulator the application closes and no error is generated on console.I wondering why its happening.

I am submitting a request to localhost via form

Here is my code

formdata.append('file', {            uri: imageResponse.uri,             name: fileName,             type: imageResponse.type        })        axios.post(url, formdata, {            headers: {"Content-Type": "multipart/form-data"            }        }).then((response) => {            var dataObj = response.data;            newMessage[0].text = JSON.stringify(dataObj.data)            if(screenType == 'group') {                this.postGroupChat(newMessage, 2)            }else {                this.postChat(newMessage, 2)            }        })        .catch((error) => {            console.log(5555, error)        });

Viewing all articles
Browse latest Browse all 16750

Trending Articles



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