Rails 关于文件上传

mlb0903 · December 04, 2013 · Last by birdfrank replied at December 17, 2013 · 2138 hits

1、问题代码 views :
<%= file_field_tag "attachment", :accept => 'application/msexcel'%> controller: att_file = params[:attachment].read att_file_name = params[:attachment].original_filename File.open("public/attachment_file", "wb") do |f| f.write(xx) end 2、问题 Permission denied - public/attachment_file

第一次做这种关于文件上传,不太知道这类错误的原因,还请大家帮忙~!!!

Web Server (nginx 还是 apache?)用哪个用户运行的?这个用户对 public/attachment_file 有没有写权限?

You need to Sign in before reply, if you don't have an account, please Sign up first.