You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was thinking of (somehow) read the binary file, convert that to base64 and post this as JSON using fetch. Is that the best way to upload this to a server for now ?
FYI transferring data back and forth between JS and Obj-C is relatively slow so you'll probably want to keep all of the image data in Obj-C. I don't have numbers but I expect you will see it takes a measurable amount of time to transfer several MB of data. It's small compared to the amount of time it takes to upload the photo but it's a good idea to keep the JS <=> Obj-C message queue clear.
You could write a tiny bridge module that receives the asset URL and then performs the upload, reporting progress/error/success information back to JS.
FYI transferring data back and forth between JS and Obj-C is relatively slow so you'll probably want to keep all of the image data in Obj-C. I don't have numbers but I expect you will see it takes a measurable amount of time to transfer several MB of data. It's a small compared to the amount of time it takes to upload the photo but it's a good idea to keep the JS <=> Obj-C message queue clear.
You could write a tiny bridge module that receives the asset URL and then performs the upload, reporting progress/error/success information back to JS.
—
Reply to this email directly or view it on GitHub.
I d be down implementing this in objective c, but since I know you guys are
about to release the internal fb component, I d rather spend my time doing
something else :)
On Thu, Mar 26, 2015 at 8:43 PM Jay Garcia notifications@github.com wrote:
FYI transferring data back and forth between JS and Obj-C is relatively
slow
I've found that React Native's bridge impl seems to be slower that
cordova's :(
I don't have specific bench marks, but if the queue is rapidly utilized,
the UI becomes non-responsive whereas with a cordova app, the UI works
fine.
I understand the mechanics of why a RN app would be come unresponsive, but
I just had to add my experience.
FYI transferring data back and forth between JS and Obj-C is relatively
slow so you'll probably want to keep all of the image data in Obj-C. I
don't have numbers but I expect you will see it takes a measurable amount
of time to transfer several MB of data. It's a small compared to the amount
of time it takes to upload the photo but it's a good idea to keep the JS
<=> Obj-C message queue clear.
You could write a tiny bridge module that receives the asset URL and
then performs the upload, reporting progress/error/success information back
to JS.
—
Reply to this email directly or view it on GitHub.
—
Reply to this email directly or view it on GitHub #201 (comment)
.
It might actually be awhile (or never) before we release the networking module we use internally, so I wouldn't wait for that if you need the functionality...
I d be down implementing this in objective c, but since I know you guys are
about to release the internal fb component, I d rather spend my time doing
something else :)
On Thu, Mar 26, 2015 at 8:43 PM Jay Garcia notifications@github.com wrote:
FYI transferring data back and forth between JS and Obj-C is relatively
slow
I've found that React Native's bridge impl seems to be slower that
cordova's :(
I don't have specific bench marks, but if the queue is rapidly utilized,
the UI becomes non-responsive whereas with a cordova app, the UI works
fine.
I understand the mechanics of why a RN app would be come unresponsive, but
I just had to add my experience.
FYI transferring data back and forth between JS and Obj-C is relatively
slow so you'll probably want to keep all of the image data in Obj-C. I
don't have numbers but I expect you will see it takes a measurable amount
of time to transfer several MB of data. It's a small compared to the amount
of time it takes to upload the photo but it's a good idea to keep the JS
<=> Obj-C message queue clear.
You could write a tiny bridge module that receives the asset URL and
then performs the upload, reporting progress/error/success information back
to JS.
—
Reply to this email directly or view it on GitHub.
—
Reply to this email directly or view it on GitHub #201 (comment)
.
—
Reply to this email directly or view it on GitHub.
If you still have this problem, or encounter it fresh, try adding a boundary to your content type 'Content-Type': 'multipart/form-data; boundary=someArbitraryUniqueString
If anyone coming here searching for why upload to an S3 pre-signed url not working as expect --> USE xhr! It works. There is a problem with fetch regarding Content-Type header. I don't really understand the detail though
Activity
ide commentedon Mar 26, 2015
FYI transferring data back and forth between JS and Obj-C is relatively slow so you'll probably want to keep all of the image data in Obj-C. I don't have numbers but I expect you will see it takes a measurable amount of time to transfer several MB of data. It's small compared to the amount of time it takes to upload the photo but it's a good idea to keep the JS <=> Obj-C message queue clear.
You could write a tiny bridge module that receives the asset URL and then performs the upload, reporting progress/error/success information back to JS.
vjeux commentedon Mar 26, 2015
You can do
It's going to send it as an attachment. We use that in the ads manager app
(I hope it's in the open source version)
jnak commentedon Mar 26, 2015
@ide I know it s not awesome. But I just need to upload one picture for now. I just want a quick way to get it done. I will optimize later :)
@vjeux it seems that the request is empty. When I pass in a string though, I do get the params passed as url params.
What's my best move to get that pic on a server while waiting for xhr.send to be updated ?
Thx!
vjeux commentedon Mar 26, 2015
cc @nicklockwood do you know if there's a difference between network implementation on opensource/internal?
nicklockwood commentedon Mar 26, 2015
@vjeux yes, they're separate. I don't think we support image upload in OSS at the moment.
jnak commentedon Mar 26, 2015
@nicklockwood do you know how I can read the binary data of the image in JS ? It's dirty but it will do the job :)
Thx guys!
jaygarcia commentedon Mar 27, 2015
I don't have specific bench marks, but if the queue is rapidly utilized, the UI becomes non-responsive whereas with a cordova app, the UI works fine.
I understand the mechanics of why a RN app would be come unresponsive, but I just had to add my experience.
JG
:: sent from my mobile device ::
jnak commentedon Mar 27, 2015
I d be down implementing this in objective c, but since I know you guys are
about to release the internal fb component, I d rather spend my time doing
something else :)
On Thu, Mar 26, 2015 at 8:43 PM Jay Garcia notifications@github.com wrote:
sahrens commentedon Mar 27, 2015
It might actually be awhile (or never) before we release the networking module we use internally, so I wouldn't wait for that if you need the functionality...
scottdixon-zz commentedon Apr 8, 2015
I faced the same issue. Here's a naive work around for the time being:https://medium.com/@scottdixon/react-native-posting-uploading-ios-camera-roll-images-to-a-server-6c74766154cd@ide is correct, it's really slow transferring data back and forth. Thumbnails seem to hold up OK.Here's a better way to read and then upload camera roll/image component data:
https://medium.com/@scottdixon/react-native-creating-a-custom-module-to-upload-camera-roll-images-7a3c26bac309
jnak commentedon Apr 8, 2015
awesome!
brentvatne commentedon Apr 15, 2015
@scottdixon - awesome 😄
For the lazy, here's a link @scottdixon's github repo
kamilkp commentedon Apr 23, 2015
Check out my react-native-file-transfer. It makes the request directly from Obj-C which is faster.
lifuzu commentedon Jul 6, 2015
@kamilkp Thank you for the sharing, the lib is really cool.
8 remaining items
anback commentedon Jan 22, 2016
let me kow when there is progress! +1!
dmmiller commentedon Jan 22, 2016
@mkonicek and @bestander are working on open sourcing modules. They would know better if this is planned and when.
bestander commentedon Jan 22, 2016
Today I plan to release maps.
And this one is next in queue.
bestander commentedon Jan 27, 2016
And Image editor is released to master.
apastel commentedon Feb 24, 2016
Anybody have an Android solution for OP's problem?
mozillo commentedon Apr 20, 2016
Android+1
anton6 commentedon Jun 22, 2016
For those who need a solution for Android, have a look if this works for you.
https://github.com/Wraptime/react-native-get-real-path
Mastergalen commentedon Aug 25, 2016
Is it possible to upload an image using
fetch()instead?woniesong92 commentedon Oct 18, 2016
This is a solution that works for Android as well. Copied from react-native-image-picker/react-native-image-picker#31, written by alvaromb.
Rashhh commentedon Dec 28, 2016
Can anybody would tell me where I am getting it wrong? using form data to upload image to server.
ViGi-P commentedon Jun 9, 2017
@Rashhh did you find a solution???
I'm facing the same problem.
JulianKingman commentedon Jul 17, 2017
If you still have this problem, or encounter it fresh, try adding a boundary to your content type
'Content-Type': 'multipart/form-data; boundary=someArbitraryUniqueStrings123121 commentedon Jan 12, 2018
If anyone coming here searching for why upload to an S3 pre-signed url not working as expect -->
USE xhr! It works. There is a problem with fetch regardingContent-Typeheader. I don't really understand the detail though