web applications - Ending request in Node.js Formidable -


i having express app using formidable file upload.

my code looks this

form         .on('field', function(field, value){              if (field == 'file_name'){                 if(value == 'filename'){                     res.send('requestinterrupted');                 }             }         })         .on('file', function(field, file){             client.putfile(file.path, file.hash, function(err, response){                 console.log(response.statuscode);             })           })         .on('end', function(){             console.log('-> upload done');             res.send('done');          }); 

basically want if suppose value of field file_name matches string want respond dont need upload completed. , if time file has been uploaded not problem. if file yet uploaded want end request there itself.

in development env not able file uploaded fast in same system. can't deploy remote server , test. so please me out if sending response have done in form.on('field', function(field, value){...}) function end request being carried further?

try res.end()

if (field == 'file_name'){     if(value == 'filename'){         res.end('requestinterrupted');     } } 

i haven't tested.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -