question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

file event is not triggered

See original GitHub issue

Hello,

I have a simple route like this:

router.post('/locations/file', busboy(), function(req, res, next) {
   console.log('here');

    req.busboy.on('file', function (fieldname, file, filename) {
        console.log('bar');
        var filePath = path.join(os.tmpdir(), filename);
        fstream = fs.createWriteStream(filePath);
        file.pipe(fstream);

       fstream.on('close', function () {
           console.log('foo');
       });
    });

    req.pipe(req.busboy);
});

And I have a weird behaviour: The file event is not triggered everytime (with the same file and the same upload form). but the ‘here’ log is displayed

I’m using express 4.6.1, connect-busboy 0.0.2 with busboy 0.2.9.

Thanks

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
vivian-hocommented, Jan 20, 2018

I do see data when doing this req.on(‘data’, function(d) { console.dir(‘’+d); });

but req.busboy.on(‘file’ is not firing…what could be wrong

0reactions
shubham-gulaticommented, Apr 28, 2019

hey, am getting same problem. My console.dir(req.headers[‘content-type’]) shows below multipart/form-data; boundary=----WebKitFormBoundaryU9h6r30qkD4r6BPb

Can someone help me fetching form data?

using this to upload form data $.ajax({ method: “POST”, url: “http://localhost:3000/api/v1/newPlatterPartner”, contentType: “application/octet-stream”, enctype: ‘multipart/form-data’, contentType: false, processData: false, data: formData, success: function (response) { alert(“Success”); } });

Please someone help…its urgent?

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML input file selection event not firing upon selecting the ...
It adds an event listener to 'change', but I tested it and it triggers even if you choose the same file and not...
Read more >
Input File change event not working - EncodeDna.com
The file input was not working (or not selecting files) after clearing the existing selections and selecting new files (images). The issue is...
Read more >
2723746 - File event not triggered automatically
File event is not raised automatically when files are placed in the directory. Job with wait event not triggered as event is not...
Read more >
Solved: on change of html input form element does not work...
I assume it's since the "change" event has not occurred since it remembers the previous file.
Read more >
Event Trigger On Synapse Not Working When The File ...
Hai, I have been trying to create an Event based Trigger and have attached it to a pipeline. Now, what is happening is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found