Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CarrierWave S3 Permission denied error trying to read from the tmp

Using CarrierWave and Amazon S3. CarrierWave config:

CarrierWave.configure do |config|
      config.ensure_multipart_form = false

      config.permissions = 0777      
      config.s3_access_key_id = 'secret_access_key_id'
      config.s3_secret_access_key = 'secret_access_key'
      config.s3_bucket = 'backet_name'
 end

I get a permission denied error trying to read from the tmp directory when uploading to s3.

Errno::EACCES

Permission denied - D:/MyDirectory/public/uploads/tmp/20110211-1021-3252-6545/my_file.txt.

What's wrong?

like image 613
Oksana Avatar asked Jan 20 '23 12:01

Oksana


1 Answers

I had this issue using Heroku, and solved it by changing the cache directory in the uploader.

def cache_dir
  "#{Rails.root}/tmp/uploads"
end
like image 85
DrewBowman Avatar answered Jan 30 '23 14:01

DrewBowman