本文介绍了Rails 3.在生产环境上上传文件时,获得Errno :: EACCES权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
该应用程序在开发中运行良好,但是在生产中,当我尝试使用Carrierwave上传文件时,出现Errno :: EACCES权限被拒绝的错误。我确定这与权限有关。如何设置允许上传文件的权限?
The app works fine in development but in production I get Errno::EACCES Permission Denied error when I try to upload a file using Carrierwave. I'm sure it has something to do with permissions. How can I set the permissions to allow file uploads?
pdf_uploader.rb
pdf_uploader.rb
def store_dir
"#{Rails.root}/uploads/#{model.id}"
end
def cache_dir
"#{Rails.root}/tmp/uploads/cache/#{model.id}"
end
推荐答案
chmod -R 777 PATH_TO_APP/uploads
chmod -R 777 PATH_TO_APP/tmp
这篇关于Rails 3.在生产环境上上传文件时,获得Errno :: EACCES权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!