Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paperclip Errno::EACCES (Permission denied - /system)

My production environment is : ruby 1.9.2-p320 , rails 3.2.7, paperclip 3.1.4, mysql, Ubuntu 8.10 x86 64bit.

I have a Errno:EACCES Permission denied /system error when i try to upload a file with paperclip. Useless to say that locally this doesn't happen. I checked the public directory permissions and it's 775, the public/system permission is 777 as well as all it's inner directory. The tmp directory permission is : 775 too. Moreover the user used to deploy the application is www-data:root

The model's attachment is set like this :

has_attached_file :fichier,
        :path => "/system/:attachment/:id/:style/:filename",
        :url => "/system/:attachment/:id/:style/:filename"

I can't find out why i get this error. Anyone has got an idea ?

Thanks

like image 582
user318722 Avatar asked Aug 08 '12 12:08

user318722


1 Answers

Your code DOES NOT try to save the uploaded file in:

/path/to/app/public/system/:attachment/:id/:style/:filename

but in:

/system/:attachment/:id/:style/:filename

Try this instead:

has_attached_file :fichier,
    :path => ":rails_root/public/system/:attachment/:id/:style/:filename",
    :url => "/system/:attachment/:id/:style/:filename"
like image 148
Mischa Avatar answered Nov 15 '22 17:11

Mischa