Skip to content

Instantly share code, notes, and snippets.

@g-eorge
Created August 31, 2011 16:43
Show Gist options
  • Save g-eorge/1184010 to your computer and use it in GitHub Desktop.
Save g-eorge/1184010 to your computer and use it in GitHub Desktop.
...
exports.upload = {
html: parseUploads
}
function parseUploads(req, res, next){
var config = formalineConfig
config.listeners.loadend = function ( req, res, next ){
console.log( '\n\033[1;32mPost Done..\033[0m' )
// log( '\n JSON -> \n', json, '\n' )
res.write( '<br>-> ' + new Date())
res.write( '<br>-> request processed!' )
res.write( '<br>-> stats -> ' + JSON.stringify( req.stats, null, 4 ))
res.write( '<br>Initial Configuration : ' + JSON.stringify( form.initialConfig, function ( key, value ) {
if ( typeof value === 'function' ) {
return '..'
}
return value
}, 4 ))
res.write( '<br>-> fields received: [ { .. } , { .. } ] <br> ****************' + JSON.stringify( req.fields, null, 1 ))
res.write( '<br>-> files written: [ { .. } , { .. } ] <br> **************<br> ' + JSON.stringify( req.files, null, 1 ))
if ( formalineConfig.removeIncompleteFiles ) {
res.write( '<br>-> partially written ( removed ): [ { .. } , { .. } ] \n *****************\n'+ JSON.stringify( req.incomplete, null, 1 ) + '\n' )
} else {
if ( req.incomplete.length !== 0 ) {
res.write( '<br>-> partially written ( not removed ): \n *****************\n' + JSON.stringify( req.incomplete, null, 1 ))
}
}
res.end()
next() // test callback
}
var form = new formaline( config )
form.parse(req, res, next)
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment