开发者

file upload via web service without browser in rails3

开发者_如何学JAVAI have to make a web call which will take a file from the user and post it to the server. i am new to web so what should mt url be like.

i tried http//www.example.com?param[id]=1

so what should the next parameter be which will take uploaded file data.

i think he has to give me the binary data of the file

thanks in advance


You need to make a simple multi-part form using the form_tag helper:

<% form_tag(examples_path, :method => :post, :multi_part => true) do %>
  <%= file_field_tag(:file) %>
  <%= submit_tag('Upload') %>
<% end %>

You can't submit files by a GET request. It must be POST, and it must be set multi-part.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜