回形针错误::EACCES(权限被拒绝 -/system) [英] Paperclip Errno::EACCES (Permission denied - /system)
问题描述
我的生产环境是:ruby 1.9.2-p320、rails 3.2.7、paperclip 3.1.4、mysql、Ubuntu 8.10 x86 64bit.
My production environment is : ruby 1.9.2-p320 , rails 3.2.7, paperclip 3.1.4, mysql, Ubuntu 8.10 x86 64bit.
当我尝试上传带有回形针的文件时,出现 Errno:EACCES Permission denied/system 错误.不用说,在本地这不会发生.我检查了公共目录权限,它是 775,公共/系统权限是 777 以及它的所有内部目录.tmp 目录权限也是:775.此外,用于部署应用程序的用户是 www-data:root
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 ?
谢谢
推荐答案
您的代码不会尝试将上传的文件保存在:
Your code DOES NOT try to save the uploaded file in:
/path/to/app/public/system/:attachment/:id/:style/:filename
但在:
/system/:attachment/:id/:style/:filename
试试这个:
has_attached_file :fichier,
:path => ":rails_root/public/system/:attachment/:id/:style/:filename",
:url => "/system/:attachment/:id/:style/:filename"
这篇关于回形针错误::EACCES(权限被拒绝 -/system)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!