Skip to content

Instantly share code, notes, and snippets.

@kevwil
Created August 11, 2011 16:35
Show Gist options
  • Save kevwil/1140111 to your computer and use it in GitHub Desktop.
Save kevwil/1140111 to your computer and use it in GitHub Desktop.
getSessionID not optional?
DEBUG: setting up form upload parsing ...
DEBUG: received message: { type: 'warning',
isupload: true,
msg: 'unable to retrieve session identifier, configuration parameter me.getSessionID must be a function!' }
/Volumes/code/git/fileservice/node_modules/formaline/lib/formaline.js:478
a( me.firstChunk, me.sendResponseToMultipart.bind( me, me.firstChunk.length )
^
TypeError: Cannot read property 'length' of null
at /Volumes/code/git/fileservice/node_modules/formaline/lib/formaline.js:478:113
at /Volumes/code/git/fileservice/node_modules/formaline/lib/formaline.js:349:72
sys.debug('setting up form upload parsing ...');
var form_config = {
uploadRootDir : settings.uploadDir(),
holdFilesExtensions : true,
listeners:{
'message':function(json){
sys.debug('received message: '+util.inspect(json));
},
'error':function(json){
sys.debug('error type '+json.type+' with message '+json.msg);
if(json.isfatal)
{
res.send({status:"error",data:json.msg}, {'Content-Type':'application/json'}, 500);
}
},
'abort':function(json){
json.debug('upload aborted; '+json.msg);
if(json.isfatal)
{
res.send({status:"error",data:'upload aborted; '+json.msg}, {'Content-Type':'application/json'}, 500);
}
},
'loadend':function(json, res, next){
if(json.files){
switch(json.files.length){
case 0:
res.send({status:"error",data:"No files found in request."}, {'Content-Type':'application/json'}, 400);
break;
case 1:
jsend(json.files[0].value[0].path, res);
break;
default:
res.send({status:"error",data:"Whoah! You uploaded multiple files! Settle down, hopscotch."}, {'Content-Type':'application/json'}, 400);
}
}
next();
}
}
};
form = new formaline(form_config);
form.parse(req, res, function(){
sys.debug('\'next\' function called ...');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment