Home › Forums › Scripts › S3 File Uploader › How to save files to folder inside of bucket?
I am trying to save the uploaded files into a folder inside of my s3 busket, but nothing i tried is working.
I am able to upload just fine directly into the bucket, but im lost on what i need to do to save the file into its own folder inside the bucket.
figured it out. S3 doesnt use folders. the folders you see are actually just filenames.
in any case, if you want to save files into a folder inside of a bucket, then simply add the folder before the filename.
line 210 on index.php
return makeid() + ‘-‘ + filename;
return ‘FOLDER_NAME/’makeid() + ‘-‘ + filename;
I also got rid of the makeid() function so my original filenames dont get changed.
not sure why this was implemented in the first place, i assume so every file upload is unique?
here is my code without the random characters before each filename
return ‘FOLDER_NAME/’+ filename;
You must be logged in to reply to this topic.
Hide your WordPress website from hackers and detectors. Read more