How to Upload File/Image to Server with Form Data in React Native

  Рет қаралды 56,774

JAS ACADAMY

JAS ACADAMY

Күн бұрын

Пікірлер: 84
@orkhannabiev9192
@orkhannabiev9192 Жыл бұрын
Thank you!! You saved me from a three-day struggle.🔥🔥🔥
@JASACADAMY
@JASACADAMY Жыл бұрын
Glad I could help!
@sushmarodrick12
@sushmarodrick12 Жыл бұрын
You mentioned to stringify object when sending data but you are sending object without stringifying and it still works. How?
@rtdev8512
@rtdev8512 Жыл бұрын
you no need to stringify file object, stringify only needed if you send non file object
@Jeancympoycoding
@Jeancympoycoding 2 ай бұрын
Bro the Backend must be hosted right ? because I tried to upload image and Video from the local the I got a message like " Load image Failed.
@ezra9383
@ezra9383 2 жыл бұрын
Am facing an error from the fetch function "Network failed... how should i resolve this"
@JASACADAMY
@JASACADAMY 2 жыл бұрын
please check server .try in postman first
@maganramkrishna
@maganramkrishna 2 жыл бұрын
I am also facing same Network failed error. I checked everything thoroughly , configuration, URL all fine. Same is working while calling with postman. Please suggest..
@sagivalia5041
@sagivalia5041 Жыл бұрын
Hey there. And how do you access it in the frontend? Like for example: a guy uploads his avatar and it should all be fetched in the rendering, how do I send him the image? through the generated image link or the image's bytes?
@JASACADAMY
@JASACADAMY Жыл бұрын
generated link will be a image url.it can display in html using img src
@sagivalia5041
@sagivalia5041 Жыл бұрын
@@JASACADAMY Can it be displayed with the Image component in react-native?
@namithareddy5496
@namithareddy5496 Жыл бұрын
Thank you so much, very helpful.
@JASACADAMY
@JASACADAMY Жыл бұрын
Glad it was helpful!
@Ganesh-sp5vm
@Ganesh-sp5vm 3 ай бұрын
Thank you , it worked !!!
@Zero-qc5nu
@Zero-qc5nu Жыл бұрын
I have question while uploading image and file using document picker using form data i got a network error sometimes and sometimes I am not getting this error in Android itz working fine in ios
@JASACADAMY
@JASACADAMY Жыл бұрын
Have you given the permission
@KingsleyOkeze
@KingsleyOkeze 8 ай бұрын
How do you give permission?
@Zero-qc5nu
@Zero-qc5nu 8 ай бұрын
@@JASACADAMY yes
@Zero-qc5nu
@Zero-qc5nu 8 ай бұрын
@@KingsleyOkeze yes by using react native permission
@j0s3805
@j0s3805 2 жыл бұрын
Hi sir, I want to send my sign up user data with the image in the same call , How can i do this ? I send my user info using body raw JSON, but i want to send the image, I can send all in the form-data?
@JASACADAMY
@JASACADAMY 2 жыл бұрын
yes you can.append with formdata
@mohammadrezadehghani3866
@mohammadrezadehghani3866 2 жыл бұрын
what should i do when i want to upload blob as form data?? becuase reactnative get network error when i append blob to form data🤔🤔 do you have any solution?!!
@JASACADAMY
@JASACADAMY 2 жыл бұрын
formdata.append("blob",blob,filename)
@qwer-dn2wq
@qwer-dn2wq 2 жыл бұрын
you saved my life...
@JASACADAMY
@JASACADAMY 2 жыл бұрын
thanks for feedback 👍
@yuval_silver8888
@yuval_silver8888 2 жыл бұрын
what you do in the api {STAGE_URL}/user/upload/image to make an public url for the photo from the formData that we sent in the request?
@JASACADAMY
@JASACADAMY 2 жыл бұрын
it is an API hosted in our server.we will not able to share that url .you can checkout any documentation for uploading file in s3 using nodejs
@omaralaufi4865
@omaralaufi4865 2 жыл бұрын
Thanks, when a user upload files the first process to create file with user display name and then upload images? Can u help on this
@nthiwafelix7967
@nthiwafelix7967 Ай бұрын
Thanks...
@JASACADAMY
@JASACADAMY 19 күн бұрын
Welcome
@vithursanthevendran1009
@vithursanthevendran1009 2 жыл бұрын
I am from Sri Lanka. I watched the video and wrote the code accordingly, but the file is not getting transferred from front end to database.
@JASACADAMY
@JASACADAMY 2 жыл бұрын
which servee are using?does it work in postman
@JASACADAMY
@JASACADAMY 2 жыл бұрын
which servee are using?does it work in postman
@vithursanthevendran1009
@vithursanthevendran1009 2 жыл бұрын
@@JASACADAMY I am using Laravel php as backend and mysql as database. Moreover, it IS working in postman
@suyashvashishtha4904
@suyashvashishtha4904 2 жыл бұрын
​@@vithursanthevendran1009 You need to transfrom the body in axios req, { responseType: "json", headers: headers, transformRequest: (data, headers) => { return bodyFormData; }, data: bodyFormData, }
@vithursanthevendran1009
@vithursanthevendran1009 2 жыл бұрын
@@suyashvashishtha4904 Thank you for the answer. Actually the issue was solved about a month ago. But i will try your method as well
@imrankhan-fn7ne
@imrankhan-fn7ne 2 жыл бұрын
hy your tutorial is very help full I am using reanimated2, that's why I have to use flipper debugger please make a tutorial
@reznov00
@reznov00 2 жыл бұрын
Could you show the backend api code too so we know how the image is being handled?
@JASACADAMY
@JASACADAMY 2 жыл бұрын
H.i you can checkout nodejs formdata with s3 doc
@נאורכהן-ת5כ
@נאורכהן-ת5כ 2 жыл бұрын
@@JASACADAMY can you give us a link for something you recommanded?
@JASACADAMY
@JASACADAMY 2 жыл бұрын
@@נאורכהן-ת5כ stackoverflow.com/questions/40494050/uploading-image-to-amazon-s3-using-multer-s3-nodejs
@osmankhalid2005
@osmankhalid2005 Жыл бұрын
Here is the backend PHP code:
@mantritech1082
@mantritech1082 2 жыл бұрын
I am following same process but image not updating But on postman its working fine Here is code for laravel backend api if ($request->hasFile('img')) { $img = '/uploads/users/'.time().'.'.$request->img->extension(); $request->img->move(public_path('uploads/users'), $img); $input['img'] = $img; } Is this compatible with our method Please tell me know how i can solve it
@JASACADAMY
@JASACADAMY 2 жыл бұрын
does formdata is creating currectly?
@aviseksahoo1953
@aviseksahoo1953 2 жыл бұрын
How to apply flipper in usb connected device ?
@JASACADAMY
@JASACADAMY 2 жыл бұрын
fbflipper.com/ flipper is a debugging tool for latest react native.
@JASACADAMY
@JASACADAMY 2 жыл бұрын
just install in your device it will automatically debug if you are using latest version of react native
@aviseksahoo1953
@aviseksahoo1953 2 жыл бұрын
@@JASACADAMY Is it require to install openSSl to use flipper and I have install but I am using my phone device through USB connect , in that situation flipper not connected , please help , thanks in advamce
@aqibabbasi1332
@aqibabbasi1332 Жыл бұрын
how to retrieve it and show in react-native
@JASACADAMY
@JASACADAMY Жыл бұрын
it will ve return url that can display using image api from react native
@arsalanahmed1161
@arsalanahmed1161 Жыл бұрын
i just do one mistake but now I did it "("Content-Type", 'multipart/form-data')" its important
@JASACADAMY
@JASACADAMY Жыл бұрын
thanks for feedback 👍
@juniormelo26
@juniormelo26 Жыл бұрын
Muito Show, parabéns.
@JASACADAMY
@JASACADAMY Жыл бұрын
thanks for feedback 👍
@santhoshpanjalavlogs3587
@santhoshpanjalavlogs3587 2 жыл бұрын
How reject selected file before upload ?
@JASACADAMY
@JASACADAMY 2 жыл бұрын
check FormData properly
@hitul1412
@hitul1412 2 жыл бұрын
possible unhandled promise rejection esi error aa rahi h
@JASACADAMY
@JASACADAMY 2 жыл бұрын
check your formdata.does api is working in postman?
@hitul1412
@hitul1412 2 жыл бұрын
But I don't use formdata when I click button After that error display
@jyotish40
@jyotish40 2 жыл бұрын
how to upload another data including image in form data
@JASACADAMY
@JASACADAMY 2 жыл бұрын
you can add more field using formdta.append
@davinderkumar6685
@davinderkumar6685 2 жыл бұрын
Very helpful keep it up 👌
@JASACADAMY
@JASACADAMY 2 жыл бұрын
thanks for feedback 👍
@ArjunYadav-np4fh
@ArjunYadav-np4fh 2 жыл бұрын
How to Upload File/Image to PHP Server in React Native, please explain or create a video on this topic.
@LucasHanchop
@LucasHanchop 2 жыл бұрын
Its almost the same...
@adnanmaulana8642
@adnanmaulana8642 2 жыл бұрын
how about upload multiple files
@JASACADAMY
@JASACADAMY 2 жыл бұрын
this.state.selectedImages.forEach((item, i) => { data.append("file", { uri: item.uri, type: "image/jpeg", name: item.filename || `filename${i}.jpg`, }); });
@JASACADAMY
@JASACADAMY 2 жыл бұрын
loop through the array
@adnanmaulana8642
@adnanmaulana8642 2 жыл бұрын
@@JASACADAMY Thankyouu !!
@adnanmaulana8642
@adnanmaulana8642 2 жыл бұрын
if we upload pdf, what the type should be written
@JASACADAMY
@JASACADAMY 2 жыл бұрын
@@adnanmaulana8642 application/pdf
@philmongere6667
@philmongere6667 2 жыл бұрын
thanks @JAS ACADAMY
@JASACADAMY
@JASACADAMY 2 жыл бұрын
thanks for feedback 👍
@azatazamatov8820
@azatazamatov8820 Жыл бұрын
cool video
@JASACADAMY
@JASACADAMY Жыл бұрын
Thanks
@ParamvirSingh-h5w
@ParamvirSingh-h5w 5 ай бұрын
thanks🤩
@JASACADAMY
@JASACADAMY 5 ай бұрын
You're welcome 😊
@willyhorizont8672
@willyhorizont8672 Жыл бұрын
subscribed!
@JASACADAMY
@JASACADAMY Жыл бұрын
thanks
@karandeepsingh7000
@karandeepsingh7000 2 жыл бұрын
When I choose mediaType: 'video', the video folder in my gallery apppears for a second and then disappear. so i am not able to choose videos. please help.
@JASACADAMY
@JASACADAMY 2 жыл бұрын
check the documentation of image picker and permission
React Native Image Upload with Expo and PHP 🤩
18:31
Simon Grimm
Рет қаралды 15 М.
Upload Files in React - Typescript, Drag and Drop, & Form Examples
12:21
А что бы ты сделал? @LimbLossBoss
00:17
История одного вокалиста
Рет қаралды 12 МЛН
Who’s the Real Dad Doll Squid? Can You Guess in 60 Seconds? | Roblox 3D
00:34
兔子姐姐最终逃走了吗?#小丑#兔子警官#家庭
00:58
小蚂蚁和小宇宙
Рет қаралды 14 МЛН
DHH discusses SQLite (and Stoicism)
54:00
Aaron Francis
Рет қаралды 94 М.
Think Fast, Talk Smart: Communication Techniques
58:20
Stanford Graduate School of Business
Рет қаралды 41 МЛН
Expo Document Picker to Node Server | React Native File Upload
13:10
Full Stack Niraj
Рет қаралды 6 М.
Beginner React.js Coding Interview (ft. Clément Mihailescu)
36:31
Ben Awad
Рет қаралды 2,2 МЛН
React Native vs Flutter in 2024 - Make the RIGHT Choice (Difference Explained)
10:31
А что бы ты сделал? @LimbLossBoss
00:17
История одного вокалиста
Рет қаралды 12 МЛН