Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .server.js.swp
Binary file not shown.
Binary file added lib/._upload_handler.js.swp
Binary file not shown.
15 changes: 9 additions & 6 deletions lib/_upload_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,26 @@ UploadHandler.prototype.post = function () {

form.uploadDir = options.tmpDir;
form.on('fileBegin', function (name, file) {
tmpFiles.push(file.path);
var fileInfo = new FileInfo(file, handler.req, true);
map[path.basename(file.path)] = fileInfo;
// tmpFiles.push(file.path);the path property is obsclete , instead use filepath
tmpFiles.push(file.filepath);
// FileInfo constructor accepts only file {name,size,type...}
// var fileInfo = new FileInfo(file, handler.req, true);
var fileInfo = new FileInfo({name});
map[path.basename(file.filepath)] = fileInfo;
fileInfo.safeName();
files.push(fileInfo);
}).on('field', function (name, value) {
if (name === 'redirect') {
redirect = value;
}
}).on('file', function (name, file) {
var fileInfo = map[path.basename(file.path)];
var fileInfo = map[path.basename(file.filepath)];
fileInfo.size = file.size;
if (!fileInfo.validate()) {
fs.unlink(file.path);
fs.unlink(file.filepath);
return;
}
fs.renameSync(file.path, options.uploadDir + '/' + fileInfo.name);
fs.renameSync(file.filepath, options.uploadDir + '/' + fileInfo.name);
if (options.imageTypes.test(fileInfo.name)) {
Object.keys(options.imageVersions).forEach(function (version) {
counter += 1;
Expand Down
Binary file added public/images/image
Binary file not shown.
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var requestHandler = require('./lib/_request_handler'),
options = require('./config/options'),
port = process.env.PORT || 8888;
port = process.env.PORT || 9999;

if (options.ssl) {
require('https').createServer(options.ssl, requestHandler).listen(port);
Expand Down