Reputation: 131
I have done some research on this but mostly I have ended up with queries to limit the number of files to be uploaded. I am developing a web application (running on nodeJS server) that has a feature to upload files (images mostly). Now, I am using a simple html form with the following input for the upload content,
<input id="myFile" type="file" name="file" multiple="multiple"/>
The goal is to accept multiple file uploads from the users upto a few thousand images. I am using the nodejs module formidable to parse the form element on upload and handle the multiple images(storing, renaming.. etc).
form.on('field', function(field, value) {
fields.push([field, value]);
})
form.on('file', function(field, file) {
files.push(file);
})
form.on('end', function() {
console.log('done');
});
form.on('progress', function(bytesReceived, bytesExpected) {
console.log('Progress so far: '+(100*(bytesReceived/bytesExpected))+"%");
});
form.parse(req, function(err, fields, files) {
//my logic to storing and handling the file uploads
}
So right now, i am able to handle uploads upto roughly 8000 images (256x256 dimensions) in a single go. But if the user selects more than this limit, the application crashes redirecting to a page that says 'this web page is not available'. I checked the browser console and it throws the following error,
POST http://localhost:3000/fileupload net::ERR_INSUFFICIENT_RESOURCES
I want to be able to handle uploads clearly exceeding this limit. I would really like to know if there is a way to handle this problem and if this is an error with respect to nodejs handling uploads or basic HTML POST request limitation. I am fairly new to this and I would really appreciate any help with this. Please do let me know if the question needs more clarification.
Upvotes: 2
Views: 3061
Reputation: 106736
The net::ERR_INSUFFICIENT_RESOURCES
error is indicating the you're running out of (memory) resources in the browser. Node can easily handle that much I/O but it seems the browser cannot cope with that much data at one time.
Upvotes: 3