summaryrefslogtreecommitdiff
path: root/bucky/util/upload.js
diff options
context:
space:
mode:
Diffstat (limited to 'bucky/util/upload.js')
-rw-r--r--bucky/util/upload.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/bucky/util/upload.js b/bucky/util/upload.js
index 517d5f7..d92183e 100644
--- a/bucky/util/upload.js
+++ b/bucky/util/upload.js
@@ -14,6 +14,7 @@ var acceptableuploadTypes = {
module.exports = {}
module.exports.init = function (opt){
+ options = opt
s3 = knox.createClient({
key: opt.key,
secret: opt.secret,
@@ -28,8 +29,8 @@ module.exports.put = function (opt) {
var file = opt.file
- var types = opt.types || acceptableuploadTypes
- var extension = types[file.mimetype]
+ var types = opt.types
+ var extension = types && types[file.mimetype]
if (opt.preserveFilename) {
filename = file.originalname
@@ -40,7 +41,7 @@ module.exports.put = function (opt) {
var remote_path = "/" + opt.dirname + "/" + filename
- if (! extension) {
+ if (types && ! extension) {
err = "Unacceptable filetype."
}
else if (opt.maxSize && file.size > opt.maxSize) {