How to integrate an Expressjs project with jQuery-File-Upload?

jQuery-File-Upload works well with Nodejs, but it's hard for me to integrate with Expressjs. Any suggestions? Thanks for attention.

PD: https://github.com/blueimp/jQuery-File-Upload

+6
source share
3 answers

express has formidable baking through Connect Connect middleware, for example. you can simply send POST files to a specific route, and then use req.files to process everything that has been downloaded.

A very simple option for handling file uploads through jQuery Form Plugin , and if you use Jade as a template engine, you just need a form that has an input for the file, and the plugin should take care of the rest.

+3
source

There is also middleware for expressing: https://github.com/aguidrevitch/jquery-file-upload-middleware

+10
source

Try using https://github.com/felixge/node-formidable in your application and make sure that you do not have any asynchronous elements (for example, those that call the database) in the app.use () chain before the formidable, because they can lead to data loss. Also verify this in app.post (), not the app.get () handler.

https://github.com/nfriedly/picsync-server/blob/master/app.js#L98 has a crude but working example of using a formidable expression.

0
source

Source: https://habr.com/ru/post/912633/


All Articles