我正在尝试将表单上上传的图像直接上传到我的 cloudinary 云。
它在我的代码上为用户编辑表单:
<%= form_for(@user) do |f| %>
<% if @user.name == nil %>
<div>
<label for="user_username">Username or Email</label>
<input id="user_username" name="user[username]" size="30" type="text" />
</div>
<% else %>
<div>
<%= f.label :username_or_Email %>
<%= f.text_field :username %>
</div>
<% end %>
<div>
<%= f.label :name %>
<%= f.text_field :name %>
</div>
<div>
<%= f.label :password %>
<%= f.password_field :password %>
</div>
<div>
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation %>
</div>
<div>
<%= file_field_tag 'image' %>
</div>
<div><%= f.submit "Update", :class => 'btn' %></div>
<% end %>
我的用户控制器提交到的地方有一行叫做:
Cloudinary::Uploader.upload(params[:image], :public_id => @user.username)
Cloudinary 文档中提供了这一行,我得到的错误是:
没有这样的文件或目录 - 屏幕截图 2012-07-26 at 3.26.05 PM.png
Request
Parameters:
{"utf8"=>"✓",
"_method"=>"put",
"authenticity_token"=>"ueS/aqqCtsIH7ikVA1pq4LfWn044xltFnPQ6Dc0yQXE=",
"user"=>{"username"=>"asuri@yahoo.com",
"name"=>"Ankit Suri",
"password"=>"[FILTERED]",
"password_confirmation"=>"[FILTERED]"},
"image"=>"Screen Shot 2012-07-26 at 3.26.05 PM.png",
"commit"=>"Update",
"id"=>"P9q5l9gmea"}
有人可以找出错误在哪里吗?