Upload Mid Node
Upload Mid Node js file ExpressJS middleware to handle ´´´multipart/form-data´´´ which is used for uploading files.
Installation
$ npm install --save uploadmidnode
Usage
On your routes file include it with require
then insert the check
function such as:
var upload_mid_node = ;app;
Options:
globalconfig =public_folders:application:docs:path: "./public/documents"limitSize: 20000000;
- path: It must contain the physical path which the file will be stored, also it will create a
temp
which is cleaned after store the files on the final path. - limitSize: The file size limit (KB);
- supportedFileExt: Supported file extensions;
After the middleware route it to the next statement you can access all your uploaded file properties on req.uploads
.
Testing
Here is a good place to make calls from a ready web app:
Just change the action
variable to your local server eg: http://localhost:PORT/upload
Any problem or suggestion get in touch.
License
MIT © Felipe Kautzmann