curl

By Phil Frilling, 17 February, 2017

In order to upload a file to a Drupal form, you need to be sure to include the hidden form_id input. After that, it is just a matter of using the name of the html element. The code looks like this:

 curl -X POST -F 'form_id=MY_DRUPAL_FORM_ID' -F 'files[xml]=@/path/to/my/file.txt' https://www.example.com/path/to/form

Tags