To add a βMarkβ answer, if you like that Fineuploader generated a UUID, but you still want the file to be uploaded to a specific folder in the bucket, you can simply use the same approach but specify the getUuid method. Just make sure that you first extract the file extension from the original file name as follows:
Non loadable jquery loader
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; } } });
source share