Skip to content

Commit c76b1e9

Browse files
author
Eddie Gonzales
committed
adding userId and uploadType
1 parent 4063ce4 commit c76b1e9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/uploadhandler.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ module.exports = function (options) {
5959
map = {},
6060
counter = 1,
6161
redirect,
62+
userId,
6263
finish = _.bind(function () {
6364
if (!--counter) {
6465
_.each(files, function (fileInfo) {
66+
fileInfo.ownerId = userId;
6567
this.initUrls(fileInfo);
6668
this.emit('end', fileInfo);
6769
}, this);
@@ -76,14 +78,19 @@ module.exports = function (options) {
7678
.on('fileBegin', function (name, file) {
7779
tmpFiles.push(file.path);
7880
var fileInfo = new FileInfo(file);
81+
fileInfo.uploadType = options.uploadType;
82+
// fileInfo.ownerId = this.req.user.id;
7983
fileInfo.safeName();
8084
map[path.basename(file.path)] = fileInfo;
8185
files.push(fileInfo);
8286
self.emit('begin', fileInfo);
8387
})
8488
.on('field', function (name, value) {
89+
console.log('name: ' + name + ' value ' + value);
8590
if (name === 'redirect') {
8691
redirect = value;
92+
} else if (name === 'userId') {
93+
userId = value;
8794
}
8895
})
8996
.on('file', function (name, file) {

0 commit comments

Comments
 (0)