-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Chrome: formData can't be used because browsers can't use on
.
#1961
Comments
//changes made to line 1134. Please check out . //For further explaination , refer http://stackoverflow.com/questions/32797573/alternative-to-onerror-this-onerror-bindthis-in-es6 |
Same thing for me, using Webpack and Chrome. |
So, is there a workaround for this? |
This came up as an issue with chrome and browserify... |
Any updates on this? using chrome and webpack |
need the solution too |
Me too. |
Any update on this? |
I used multipart option and I set
|
@alessandropilastrini thanks, this worked as a nice workaround. |
+1 |
I used this:
|
I played around with many variations of request's multipart configurations and could not get it to work with file data. I quickly tried looking into the issue and it appears that there is quite a bit of the the For now, I've gone ahead and decided to use needle as it just works ;) |
thanks @alessandropilastrini for your workaround. That works well. If you have an HTML5 upload, you can use a FileReader for the File. const fileReader = new window.FileReader();
fileReader.onload = function(e) {
const filename = "somefilename.png";
request({
method: 'POST',
uri: uriToCall,
headers: { 'Content-Type': 'multipart/form-data'},
multipart: {
chunked: false,
data: [
{
'Content-Disposition': `form-data; name="filedata"; filename="${filename}"`,
body: e.target.result
}
]
};
})
};
fileReader.readAsArrayBuffer(binaryData); |
Is there a way to upload big size file for browsers? |
Had the same problem, couldn't find a solution. Ended up using superagent. |
Same problem here. |
I have tried this solution and still run into this error. Is there an updated workaround? |
I needed to use this to upload files to the server in an electron app. I worked around this error by running the request in the main process rather than the renderer process and using ipc messages to synchronize back and forth. |
@dafergu2, I had the same issue in electron app. But my solution was to get the
|
I'm not sure if browser support is a goal of this lirbary, but when using this library via Browserify, you cannot make multipart/form requests.
Sample Request
Error:
Uncaught TypeError: self._form.on is not a function request.js:1134.
It looks like browsers don't support the
.on('error')
call.The text was updated successfully, but these errors were encountered: