Created
August 11, 2011 16:35
-
-
Save kevwil/1140111 to your computer and use it in GitHub Desktop.
getSessionID not optional?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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