I have made a ruby on rails application with amw S3.
I can upload the photo, but I try to delete the photo, even though the photo reference is deleted in database, the photo is still in S3.
How do I actually delete files from S3?
Your question isn't correctly specified. If you could provide more information, it would be great. But here are some options how to handle files on Amazon S3.
According to this documentation you can use method delete(see the implementation) from the Ruby Library for Amazon's Simple Storage Service's (S3) REST API.
So the should look like this:
AWS::S3::S3Object.delete('goodbye.txt', 'my-new-bucket')
Very helpful could be also this question.
Anyway I highly recommend you to use Paperclip or Carrierwave when uploading files to Amazon S3. Some helpful articles:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With