I'm using Formiable-node for uploading files. I'm getting the following error when attempting to cancel an upload.
[Error: Request aborted]
events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: EBADF, write
My code looks like the following.
on('field', function (name, value) {
if(handler.req.method == "POST" && name == "customData")
{
var validationObject = JSON.parse(value);
//This is query to the db to check authorization.
when(security.secure(validationObject.userId, validationObject.message, validationObject.hash),
function(secureData){
var message = JSON.parse(validationObject.message);
var validTime = new Date(message.time);
if(validTime >= new Date())
{
options.uploadDir = __dirname + '/public/files/'+validationObject.id ;
}
else
{
handler.req.connection.destroy();
}
},
function(err){
handler.req.connection.destroy();
});
}
I'm also using https://github.com/blueimp/jQuery-File-Upload/blob/master/index.html which is using formiable as one of the back end.
Thanks.