Closed ssohjiro closed 10 years ago
@ssohjiro I understand, but as of now the options are global to the module and is not passed by reference across functions. If I need to change that to a method level (get, post, delete), I need to run a check if the prerequisites (like folders & aws config etc..) are proper, for every single request.
This seemed more costly than having multiple single time instantiated uploaders. Let me know what you think.
Closing as no response.
AWS integration, how about:
var options = {
//resume
storage : {
type : 'aws',
aws : {
accessKeyId : 'XXXXXXXXXXXXXXXXXXXXXXXX',
secretAccessKey : 'XXXXXXXXXXXXXXXXXXXXXXXX',
region : 'us-west-2',
bucketName : 'mybucket'
}
}
};
exports.create = function(req, res) {
var id = req.params.id; // if id = '645645646';
options.storage.aws.bucketDir = id; // will save on /mybucket/645645646/
uploader.post(req, res, function (obj, redirect, error) {
if(!error)
{
res.send(JSON.stringify(obj));
}
});
};
};
dinamic saving path on bucket
It´s posible? without creating new instances of the uploader?
Thanks for proposing a solution @josh256 but if you can see the source code : https://github.com/arvindr21/blueimp-file-upload-expressjs/blob/master/index.js#L43 we are mapping the object when we init. Once the variable is in memory, we are have to update it on every upload.
Yes I understand @arvindr21, I'm proposing a new option for future releases ;)
Makes sense. Will keep this in mind next time I push something! Thanks!
Thank you @arvindr21 :)
I'm making web app like web hard as private project. Sometimes I need upload file to different directory in my server, but this blueimp-file-upload-expressjs module can not change options value(such as uploadDir) after creating instance.
Temporarily, I'm making instances at all such above occasions by different options. I think that this task may have a CPU calculate unnecessary initializing works. So I want you to add APIs that can change options after creating instance.