-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react-native 0.63.2 Image upload error [TypeError: Network request failed] #29493
Comments
My application needs to solve this problem, I have had an issue with iOS since upgrading to version 0.63.x |
am have same issues with react native 0.63 |
I had the same issue in rn v0.62.2. Solved it by upgrading flipper version to 0.47.0 |
@sjonchhe How do you upgrade the Flipper version for iOS? Did you update it in However, updating to (For Android I update |
i remember this issue, i spent 4 days to google this thing out but nothing works. |
For me it's an issue because the requests of packages I use (i.e. |
In my case, the problem was Flipper. |
Same error here, iOS app work perfectly but Android is failing on 0.62.2, 0.63.0, 0.61...
I already disabled Flipper and still failing, oh god! I've expending to much time facing error with iOS releasing and now this thing, what's next? |
Duplicate of #28551 Let me know if the solutions on that issue help resolve this. |
same issue+1 |
same issue +1 |
Iam using "react-native": "0.63.2" Error gone i did like this way. |
I am also using "react-native": "0.63.2"my error Gone i did in the same way above : 1)Added a comment my code 👍
|
same issue |
still getting same, rn version 0.63.4 and FLIPPER_VERSION=0.54.0. please suggest how can i fix ? |
Doing this: appending the uri information does not work. It doesn't even send the network request when I try to append an object. But if I append it as a string using Json stringify method. Then it will send the request, but it breaks for obvious reasons. Why is FormData not allowing me to append an object? from react-native-image-picker/react-native-image-picker#798 by https://github.com/reboss |
### Answer ### Additional
This code will properly Read your file as base64, detected file type, extension, create a path where you desire (this path will be your uri further) and store your image localy on your phone as a base64 image Usage example:
|
Description:
When I am trying to post data with fetch() it will post data successfully but if image or any file try to post then it will throw error as shown below
Error : [TypeError: Network request failed]
code:
function openImagePicker() {
ImagePicker.openPicker({
width: 300,
height: 400,
cropping: true
})
.then(image => {
console.log(image.path);
const data = new FormData();
data.append('email', "email");
data.append('file', { uri:image.path, name: 'image.jpg', type: 'image/jpeg/jpg'});
}
Note:
android:usesCleartextTraffic="true"
in this file android/app/src/main/AndroidManifest.xml
React Native version: "react-native": "0.63.2",
Tried this all solution but not working
1 : By giving Permission
uesCleartextTraffic="true" to the AndroidManifest.xml file found inside the dir android/app/src/main/AndroidManifest.xml
for handle http and https
2: Adding comment
// initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
in this file /android/app/src/main/java/com/{your_project}/MainApplication.java
3: Adding comment
// builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
in his file android/app/src/debug/java/com/{your_project}/ReactNativeFlipper.java
4: By upgrading upgrade react native to 63.2 or new version
5: FLIPPER version upgrading to 50.0
Source image
The text was updated successfully, but these errors were encountered: