To begin with, it can be easy to install Firebug or a similar tool and take a look at the sent request sent when the image is downloaded via the browser. The reason you need it is because the parameters can be named based on your rail model. Example:
Let's say your model is photographs. And let the URL be "http: // localhost: 3000 / pictures". Then the team will be something like this.
curl http://localhost:3000/pictures -F commit=Save -F picture[photo]=@test.jpg
commit = Save is the name and value of the submit button of your form. Other options will vary depending on your application. -F must be executed before the parameter itself.
If your application has authentication, use the following command.
curl --user user:password http://localhost:3000/pictures -F commit=Save -F picture[photo]=@test.jpg
source
share