function(req, res, runMethod) {
    var form = new formidable.IncomingForm()
        ,files = {}
        ,fields = {}
        ,size = 0                

    for(var i in formConfig) {
        form[i] = formConfig[i]
    }
    form.on('file', function(field, file) {
        size += file.size
        if(size > maxUploadSize) {
            return false;
        }
        if(files[field]) {
            if(!util.isArray(files[field])) files[field] = [files[field]]                    
            files[field].push(file)        
        } else {
            files[field] = file;
        }
    })            
    form.on('field', function(field, value) {
        if(fields[field]) {
            if(!util.isArray(fields[field])) fields[field] = [fields[field]]                    
            fields[field].push(value)        
        } else {
            fields[field] = value;
        }
    })            
    form.on('end', function() {
        fields.files = files
        runMethod(req, res, fields); 
    });
    form.parse(req); 
}
function(req, res, runMethod) {
    var form = new formidable.IncomingForm()
        ,files = {}
        ,fields = {}
        ,size = 0                

    for(var i in formConfig) {
        form[i] = formConfig[i]
    }
    form.on('file', function(field, file) {
        size += file.size
        if(size > maxUploadSize) {
            return false;
        }
        if(files[field]) {
            if(!util.isArray(files[field])) files[field] = [files[field]]                    
            files[field].push(file)        
        } else {
            files[field] = file;
        }
    })            
    form.on('field', function(field, value) {
        if(fields[field]) {
            if(!util.isArray(fields[field])) fields[field] = [fields[field]]                    
            fields[field].push(value)        
        } else {
            fields[field] = value;
        }
    })            
    form.on('end', function() {
        fields.files = files
        runMethod(req, res, fields); 
    });
    form.parse(req); 
}
function ( req , res , runMethod ) { var form = new formidable . IncomingForm ( ) , files = { } , fields = { } , size = 0 for ( var i in formConfig ) { form [ i ] = formConfig [ i ] } form . on ( 'file' , function ( field , file ) { size += file . size if ( size > maxUploadSize ) { return false ; } if ( files [ field ] ) { if ( ! util . isArray ( files [ field ] ) ) files [ field ] = [ files [ field ] ] files [ field ] . push ( file ) } else { files [ field ] = file ; } } ) form . on ( 'field' , function ( field , value ) { if ( fields [ field ] ) { if ( ! util . isArray ( fields [ field ] ) ) fields [ field ] = [ fields [ field ] ] fields [ field ] . push ( value ) } else { fields [ field ] = value ; } } ) form . on ( 'end' , function ( ) { fields . files = files runMethod ( req , res , fields ) ; } ) ; form . parse ( req ) ; }
Create multipart parser to parse given request
Create multipart parser to parse given request