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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 11:03:15

问题


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


回答1:


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"


来源:https://stackoverflow.com/questions/11864175/paperclip-errnoeacces-permission-denied-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!