Re: emulate RoR web from with cURL?

Philip Hallstrom
Thu, 28 Jun 2007 19:55:26 -0000

> I tried the following command
> curl -F "uploaded_data=@curltest.docx"
http://localhost:3000/raw_data_files/create
>
> and got the following errors from attachment_fu (file upload plugin)
>
> There were problems with the following fields:
>    * Content type can''t be blank
>    * Size is not included in the list
>    * Size can''t be blank
>    * Filename can''t be blank
>
> Here''s my view which works fine on the upload (unlike cURL):
> <%= error_messages_for :raw_data_file %>
>
> <% form_for(:raw_data_file, :url => raw_data_files_path, :html =>
> { :multipart => true }) do |form| %>
>
> Upload a file:
>    <%= form.file_field :uploaded_data %>
>
>
> <%= submit_tag "Create" %>
> <% end %>

Are you sure "uploaded_data" is the name of the *HTML* field that your
view produces?  I think it''s gonna really be
"raw_data_file[uploaded_data]".

So your curl test is getting a blank upload and all those errors are
because that information about your file (which it never got) is missing.

-philip

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---