Forum: Ruby on Rails emulate RoR web from with cURL?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Bbdc298cd824989df148bc5312ab4bc3?d=identicon&s=25 chirag (Guest)
on 2007-06-28 21:15
(Received via mailing list)
I tried the following command
curl -F "uploaded_data=@curltest.docx"

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| %>
    <label for="uploaded_data">Upload a file:</label>
    <%= form.file_field :uploaded_data %>

  <p> <%= submit_tag "Create" %> </p>
<% end %>

How do I manually set the filename, size, and content type in cURL? It
works fine with the above RoR view.

2f9a03aa0fcfe945229cb6126eda2cb2?d=identicon&s=25 Philip Hallstrom (Guest)
on 2007-06-28 21:44
(Received via mailing list)
>  <p> <%= submit_tag "Create" %> </p>
> <% end %>

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

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

This topic is locked and can not be replied to.