# Emulate RoR web from with cURL?

**URL:** <https://www.ruby-forum.com/t/emulate-ror-web-from-with-curl/108075>\
**Category:** Rails\
**Created:** [June 28, 2007, 9:15pm UTC](https://www.ruby-forum.com/t/emulate-ror-web-from-with-curl/108075 "2007-06-28T21:15:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chirag](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@chirag](https://www.ruby-forum.com/u/chirag)\
**Post date:** [June 28, 2007, 9:15pm UTC](https://www.ruby-forum.com/t/emulate-ror-web-from-with-curl/108075/1 "2007-06-28T21:15:30Z")

</div>

I tried the following command  
curl -F “uploaded\_data=@curltest.docx”  
[http://localhost:3000/raw\_data\_files/create](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

---

<div class="post-metadata">

**Author:** ![chirag](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@chirag](https://www.ruby-forum.com/u/chirag)\
**Post date:** [June 28, 2007, 9:44pm UTC](https://www.ruby-forum.com/t/emulate-ror-web-from-with-curl/108075/2 "2007-06-28T21:44:34Z")

</div>

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