react-native-image-crop-picker icon indicating copy to clipboard operation
react-native-image-crop-picker copied to clipboard

Unable to upload image to backend server

Open akanz opened this issue 3 years ago • 4 comments

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.38.0
  • react-native v0.69

Platform

  • iOS
  • Android

Expected behaviour

I want to upload the image and receive a secure url

Actual behaviour

I always get a 400 error which says invalid file type. NB: I have tried both axios and fetch and tried alot of solutions seen, but none seem to work. any help will be greatly associated.

Screenshot 2022-07-28 at 10 24 41 Screenshot 2022-07-28 at 10 24 41

akanz avatar Jul 28 '22 09:07 akanz

Any solution for this? Facing the same, It's working fine on ios but cannot upload to the server on Android.

ahmadcitrusbits avatar Aug 01 '22 05:08 ahmadcitrusbits

I wasn’t able to get it to work on either. can you share your code snippet? android uri is different, also it doesn’t come with filename

akanz avatar Aug 01 '22 06:08 akanz

Any update on this?

Onibenjo avatar Aug 18 '22 15:08 Onibenjo

Fixed.... For my case, the file name wasn't having an extension.

Onibenjo avatar Aug 18 '22 15:08 Onibenjo

Hey guys, I had to upload base64 string, albeit a 0.33 increase in size

akanz avatar Oct 30 '22 12:10 akanz

fromData.append("file", { name:fileName, type: ImageOrVideo.mime, uri: Platform.OS === "android" ? ImageOrVideo.path : ImageOrVideo.path.replace("file://", "") });

headers: { "x-access-token":AppGlobal.auth_token.accessToken, "Content-Type": "multipart/form-data", Accept: "application/json", }

I am unable to upload image back end server Flask (python) any one help on this thanks in advance

chganesh avatar Dec 14 '22 11:12 chganesh