Description
multipart/form-data saving to disk made easy.
Requirements
- node.js -- v0.8.0 or newer
- busboy -- v0.2.9 or newer
- gridfs-stream -- v0.5.3 or newer
- streamifier -- v0.1.1 or newer
- mongodb -- v1.4.30 (haven't tested with ~2.0)
Install
npm install nodefu
Usage
var express = var nodefu = var app = app
You can access the files in the request
object and save them to disk like this:
reqfilesfieldName
fieldName
: the name of the input field on your htmlpath
: string containing the save pathfilename
: optional parameter string that specifies the name of the file ( if none is passed, the file name will be the same )callback
: callback function with err and data attributes, respectively
And to save the uploaded files to mongodb, first you have to specify the mongodb path when using the middleware:
app
And now you can call this method from the request object:
reqfilesfieldName
fieldName
: the name of the input field on your htmlfilename
: optional parameter string that specifies the name of the file ( if none is passed, the file name will be the same )callback
: callback function with err and data attributes, respectively
You can also access data passed through multipart/form-data other than files using
reqfieldsotherFieldName
HTML
Angular
If you are using angular, I recommend using the ng-file-upload
module. You can check it out on here.
->♥<-