<commit_before>

var http = require('http'),
    formaline = require('../lib/formaline').formaline,
    connect = require('connect'),
    server;
    
var getHtmlForm = function(req, res,next) {
  if (req.url === '/test/') {
    log( ' -> req url :', req.url );
    res.writeHead(200, {'content-type': 'text/html'});
    res.end('<html><head></head><body>\
             <b>Multiple File Upload:</b><br/><br/>\
             <form action="/test/upload" enctype="multipart/form-data" method="post">\
             <input type="text" name="demotitle1"><br>\
             <input type="file" name="multiplefield1" multiple="multiple"><br>\
             <input type="text" name="demotitle2"><br>\
             <input type="file" name="multiplefield2" multiple="multiple"><br>\
             <input type="text" name="demotitle3"><br>\
             <input type="file" name="multiplefield3" multiple="multiple"><br>\
             <input type="submit" value="Upload">\
             </form><br/>\
             <b>Simple Post:</b><br/><br/>\
             <form action="/test/post" method="post">\
             <input type="text" name="simplefield1"><br>\
             <input type="text" name="simplefield2"><br>\
             <input type="text" name="simplefield3"><br>\
             <input type="submit" value="Submit">\
             </form><br/>\
             <b>Iframe Multiple File Upload:</b><br/><br/>\
             <form action="/test/upload" method="post" enctype="multipart/form-data" target="iframe">\
             <input type="file" name="file" multiple  src="" frameborder="1" />\
             <input type="submit" />\
             </form>\
             <iframe name="iframe" width="100%" height="400px"></iframe>\
             </form>\
             </body></html>'
    );
  } else {
    next();
  }
};
var log = console.log,
    dir =  '/tmp/';


    
var handleFormRequest = function( req, res, next ){
    var receivedFiles = {},
        removedFiles = {},
        receivedFields = {},
        form = null,
        config = {
        
            //default is true -->
        holdFilesExtensions : true,
        
            //default is /tmp/ -->
        uploadRootDir: dir,
        
            //default is false
            //return sha1 digests for files received?  -->
        sha1sum: true,
        
            // default is false, or integer chunk factor, 
            // every n chunk emit event 1+(0*n) 1+(1*n),1+(2*n),1+(3*n), 
            // minimum factor value is 2 -->
        emitDataProgress: false,//false,true,3,10,100
        
            // max bytes allowed, this is the max bytes written to disk before stop to write 
            // this is also true for serialzed fields not only for files upload  -->
        uploadThreshold: 1024*1024*1024,//bytes ex.: 1024*1024*1024, 512
        
            //default false, bypass headers value, continue to write to disk 
            //until uploadThreshold bytes are written. 
            //if true -> stop receiving data, when headers content length exceeds uploadThreshold
        checkContentLength: false,
        
            //remove file not completed due to uploadThreshold, 
            //if true formaline emit fileremoved event, 
            //otherwise return a path array of incomplete files 
        removeIncompleteFiles : true,
        
            //enable various logging levels
            //it is possible to switch on/off one or more levels at the same time
            //debug: 'off' turn off logging
        logging: 'debug:on,1:on,2:on,3:on',
        
            //listeners
        listeners: {
                'warning': function( msg ){
                    log('\n warning  -->',msg);<commit_msg>Turned off 3rd level logging on example modified:   examples/simpleUpload.js<commit_after>

var http = require('http'),
    formaline = require('../lib/formaline').formaline,
    connect = require('connect'),
    server;
    
var getHtmlForm = function(req, res,next) {
  if (req.url === '/test/') {
    log( ' -> req url :', req.url );
    res.writeHead(200, {'content-type': 'text/html'});
    res.end('<html><head></head><body>\
             <b>Multiple File Upload:</b><br/><br/>\
             <form action="/test/upload" enctype="multipart/form-data" method="post">\
             <input type="text" name="demotitle1"><br>\
             <input type="file" name="multiplefield1" multiple="multiple"><br>\
             <input type="text" name="demotitle2"><br>\
             <input type="file" name="multiplefield2" multiple="multiple"><br>\
             <input type="text" name="demotitle3"><br>\
             <input type="file" name="multiplefield3" multiple="multiple"><br>\
             <input type="submit" value="Upload">\
             </form><br/>\
             <b>Simple Post:</b><br/><br/>\
             <form action="/test/post" method="post">\
             <input type="text" name="simplefield1"><br>\
             <input type="text" name="simplefield2"><br>\
             <input type="text" name="simplefield3"><br>\
             <input type="submit" value="Submit">\
             </form><br/>\
             <b>Iframe Multiple File Upload:</b><br/><br/>\
             <form action="/test/upload" method="post" enctype="multipart/form-data" target="iframe">\
             <input type="file" name="file" multiple  src="" frameborder="1" />\
             <input type="submit" />\
             </form>\
             <iframe name="iframe" width="100%" height="400px"></iframe>\
             </form>\
             </body></html>'
    );
  } else {
    next();
  }
};
var log = console.log,
    dir =  '/tmp/';


    
var handleFormRequest = function( req, res, next ){
    var receivedFiles = {},
        removedFiles = {},
        receivedFields = {},
        form = null,
        config = {
        
            //default is true -->
        holdFilesExtensions : true,
        
            //default is /tmp/ -->
        uploadRootDir: dir,
        
            //default is false
            //return sha1 digests for files received?  -->
        sha1sum: true,
        
            // default is false, or integer chunk factor, 
            // every n chunk emit event 1+(0*n) 1+(1*n),1+(2*n),1+(3*n), 
            // minimum factor value is 2 -->
        emitDataProgress: false,//false,true,3,10,100
        
            // max bytes allowed, this is the max bytes written to disk before stop to write 
            // this is also true for serialzed fields not only for files upload  -->
        uploadThreshold: 1024*1024*1024,//bytes ex.: 1024*1024*1024, 512
        
            //default false, bypass headers value, continue to write to disk 
            //until uploadThreshold bytes are written. 
            //if true -> stop receiving data, when headers content length exceeds uploadThreshold
        checkContentLength: false,
        
            //remove file not completed due to uploadThreshold, 
            //if true formaline emit fileremoved event, 
            //otherwise return a path array of incomplete files 
        removeIncompleteFiles : true,
        
            //enable various logging levels
            //it is possible to switch on/off one or more levels at the same time
            //debug: 'off' turn off logging
        logging: 'debug:on,1:on,2:on,3:off',
        
            //listeners
        listeners: {
                'warning': function( msg ){
                    log('\n warning  -->',msg);
{'fraction_non_alphanumeric': 0.14786462530217567, 'fraction_numerical': 0.017861939296266453, 'mean_word_length': 1.8478011472275335, 'pattern_counts': {'":': 0, '<': 105, '<?xml version=': 0, '>': 121, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '84522', 'n_tokens_mistral': 2117, 'n_tokens_neox': 1997, 'n_words': 559}