我想直接上傳一張圖片上傳到我的cloudinary雲上的圖像。直接上傳與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提供的文件,我得到的錯誤是:
No such file or directory - Screen Shot 2012-07-26 at 3.26.05 PM.png
Request
Parameters:
{"utf8"=>"✓",
"_method"=>"put",
"authenticity_token"=>"ueS/aqqCtsIH7ikVA1pq4LfWn044xltFnPQ6Dc0yQXE=",
"user"=>{"username"=>"[email protected]",
"name"=>"Ankit Suri",
"password"=>"[FILTERED]",
"password_confirmation"=>"[FILTERED]"},
"image"=>"Screen Shot 2012-07-26 at 3.26.05 PM.png",
"commit"=>"Update",
"id"=>"P9q5l9gmea"}
可有人請找出錯誤所在?