Emulate RoR web from with cURL?

I tried the following command
curl -F “[email protected]
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 %>

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

Chirag

<%= 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs