gpt4 book ai didi

ruby-on-rails - 回形针 Errno::EACCES(权限被拒绝 -/system)

转载 作者:行者123 更新时间:2023-12-04 05:43:42 25 4
gpt4 key购买 nike

我的生产环境是:ruby 1.9.2-p320,rails 3.2.7,paperclip 3.1.4,mysql,Ubuntu 8.10 x86 64bit。

当我尝试使用回形针上传文件时出现 Errno:EACCES Permission denied/system 错误。不用说在本地不会发生这种情况。
我检查了公共(public)目录权限,它是 775,公共(public)/系统权限是 777 以及它的所有内部目录。 tmp 目录权限也是:775。
此外,用于部署应用程序的用户是 www-data:root

模型的附件设置如下:

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

我不知道为什么我会收到这个错误。有人有想法吗?

谢谢

最佳答案

您的代码不会尝试将上传的文件保存在:

/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"

关于ruby-on-rails - 回形针 Errno::EACCES(权限被拒绝 -/system),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11864175/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com