To add to Mark's answer if you like that Fineuploader generated the UUID but you still wanted the file to be uploaded to a certain folder within the bucket you can just use the same approach but specify the method getUuid
. Just make sure you extract the file extension from the original file name first like so:
Non-jquery uploader
uploader = new qq.s3.FineUploader({
// ....
objectProperties: {
key: function (fileId) {
var filename = uploader.getName(fileId);
var uuid = uploader.getUuid(fileId);
var ext = filename.substr(filename.lastIndexOf('.') + 1);
return 'folder/within/bucket/' + uuid + '.' + ext;
}
}
});
jQuery Uploader
$("#fineuploader-s3").fineUploaderS3({
// ....
objectProperties: {
key: function (fileId) {
var filename = $('#fineuploader-s3').fineUploader('getName', fileId);
var uuid = $('#fineuploader-s3').fineUploader('getUuid', fileId);
var ext = filename.substr(filename.lastIndexOf('.') + 1);
return 'folder/within/bucket/' + uuid + '.' + ext;
}
}
});