Skip to content
Merged
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
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function uploadService(opts) {
var tmpFiles = [];
var files = [];
var map = {};
var fields = {};
var redirect;

this.config.host = req.headers.host;
Expand Down Expand Up @@ -74,10 +75,11 @@ function uploadService(opts) {
tmpFiles.push(file.path);
// fix #41
configs.saveFile = true;
var fileInfo = new FileInfo(file, configs);
var fileInfo = new FileInfo(file, configs, fields);
map[fileInfo.key] = fileInfo;
files.push(fileInfo);
}).on('field', function(name, value) {
fields[name] = value;
if (name === 'redirect') {
redirect = value;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/fileinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var getFileKey = function(filePath) {
};
var udf;

function FileInfo(file, opts) {
function FileInfo(file, opts, fields) {
this.name = file.name;
this.size = file.size;
this.type = file.type;
Expand All @@ -26,6 +26,7 @@ function FileInfo(file, opts) {
this.proccessed = false;
this.width = udf;
this.height = udf;
this.fields = fields;
if (opts.saveFile) {
this.safeName();
}
Expand Down