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
That's a server side library though, last I checked it wouldn't run on the client, and even if it does run on the client, requireing FormData on the client seems insane since it's already there.
What I'd like would be something where you could say:
@ForbesLindesay I am curious. What exactly are you doing with the FormData
object?
If you are uploading in the browser you can already do that with jquery or
something similar with the browsers' FormData implementation. If you like
the http lib on node, and you want to use it to upload something from the
browser, use the request lib with browserify. It transparently handles the
problems for you. I guess I don't know how adding a FormData-browserify to
the browserify stack will solve your issue.
My point is how would you write this on node using a feature of http that
would handle FormData differently than the way a post encoded in multipart
would work in http-browserify?
On Jul 11, 2013 11:37 PM, "Forbes Lindesay" notifications@github.com
wrote:
That's a server side library though, last I checked it wouldn't run on the
client, and even if it does run on the client, requireing FormData on the
client seems insane since it's already there.
What I'd like would be something where you could say:
var request = http.request(options)request.end(FormData)
on the client.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/20#issuecomment-20858112
.
What I'm saying is I'd like to be able to have the one file look something like:
varFD=FormData||require('form-data')varhyperquest=require('hyperquest')varconcat=require('concat-stream')module.exports=postfunctionpost(file,clientID,callback){varfd=newFD()fd.append('image',file)varheaders=fd.getHeaders()headers.Authorization='Client-ID '+clientIDvarreq=hyperquest.post('https://api.imgur.com/3/image.json',{headers: headers})req.on('error',callback)//not sure what this API call should look likereq.attachFormData(fd)req.pipe(concat(function(res){callback(null,res)}))}
Activity
jackcviers commentedon Jul 12, 2013
@ForbesLindesay take a look at mikeal/request. It does what you need with FormData, and has several nice examples.
ForbesLindesay commentedon Jul 12, 2013
That's a server side library though, last I checked it wouldn't run on the client, and even if it does run on the client,
requireingFormDataon the client seems insane since it's already there.What I'd like would be something where you could say:
on the client.
jackcviers commentedon Jul 12, 2013
@ForbesLindesay I am curious. What exactly are you doing with the FormData
object?
If you are uploading in the browser you can already do that with jquery or
something similar with the browsers' FormData implementation. If you like
the http lib on node, and you want to use it to upload something from the
browser, use the request lib with browserify. It transparently handles the
problems for you. I guess I don't know how adding a FormData-browserify to
the browserify stack will solve your issue.
My point is how would you write this on node using a feature of http that
would handle FormData differently than the way a post encoded in multipart
would work in http-browserify?
On Jul 11, 2013 11:37 PM, "Forbes Lindesay" notifications@github.com
wrote:
ForbesLindesay commentedon Jul 12, 2013
OK, what I'm doing is using it to upload images to
imgur. I ended up with: https://github.com/ForbesLindesay/imsave/blob/master/lib/post.js on the server and https://github.com/ForbesLindesay/imsave/blob/master/lib/post-browser.js on the client.What I'm saying is I'd like to be able to have the one file look something like:
juliangruber commentedon Feb 15, 2014
see #43
scottcorgan commentedon May 12, 2014
has there been any work to support piping xhr2 files/buffers/etc into the request?
Ran into this headache recently and it breaks in Firefox.
lakenen commentedon Jul 25, 2014
@ForbesLindesay did you ever figure out how to get hyperquest working with FormData?
ForbesLindesay commentedon Jul 25, 2014
no, I'm just using browser APIs for making requests on the browser. Helps keep the bundle small since I don't need node streams on the client anyway.