Rails - Errno :: EACCES(权限被拒绝)当用户上传头像时 [英] Rails - Errno::EACCES (Permission denied) when uploading avatar for user
问题描述
我有:
本地主机上传工作正常。但它不适用于heroku。
我的日志是:
在13ms内完成500次内部服务器错误
Errno :: EACCES(Permission denied - / app / public / uploads / tmp):
app / controllers / users_controller.rb:73:'update'
cache:[POST / users / 2] invalidate,pass
我的73行是:
试着使这个 om本地计算机并推送到heroku并失败
我还能你不能在Heroku的服务器上存储文件,所以上传并试图将文件保存到本地文件系统中将不会工作。
相反,您应该上传文件到S3。 Heroku文档和 CarrierWave文档都有关于配置CarrierWave通过雾将文件上传到S3的信息。查看文档,获得一个S3账户,并在那里上传文件。
I have:
- heroku
- rails 3
- carrierwave
On localhost uploading works fine. But it doesnt work on heroku. My logs are:
Completed 500 Internal Server Error in 13ms
Errno::EACCES (Permission denied - /app/public/uploads/tmp):
app/controllers/users_controller.rb:73:in `update'
cache: [POST /users/2] invalidate, pass
My 73 line is:
if @user.update_attributes(params[:user])
Tryed to make this om local computer and push to heroku and failed
What else can I do?
You can't store files on Heroku's servers, so uploading and trying to save files to the local filesystem will not work.
Instead, you should probably upload files to S3. The Heroku documentation and CarrierWave documentation both have information on configuring CarrierWave to upload files to S3 via fog. Check out the documentation, get an S3 account, and upload your files there.
这篇关于Rails - Errno :: EACCES(权限被拒绝)当用户上传头像时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!