summaryrefslogtreecommitdiffstats
path: root/app/core/files.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/core/files.js')
-rw-r--r--app/core/files.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/core/files.js b/app/core/files.js
index 5565a19..1c4dd75 100644
--- a/app/core/files.js
+++ b/app/core/files.js
@@ -25,8 +25,9 @@ FileManager.prototype.create = function(options, cb) {
if (settings.allowed_file_types &&
settings.allowed_file_types.length &&
- !_.include(settings.allowed_file_types, options.file.type)) {
- return cb('The MIME type ' + options.file.type + ' is not allowed');
+ !_.include(settings.allowed_file_types, options.file.mimetype)) {
+ return cb('The MIME type ' + options.file.mimetype +
+ ' is not allowed');
}
Room.findById(options.room, function(err, room) {
@@ -37,11 +38,11 @@ FileManager.prototype.create = function(options, cb) {
if (room.archived) {
return cb('Room is archived.');
}
-
+
new File({
owner: options.owner,
- name: options.file.name,
- type: options.file.type,
+ name: options.file.originalname,
+ type: options.file.mimetype,
size: options.file.size,
room: options.room
}).save(function(err, savedFile) {