upload multiple files to php server using curl command line

The trick is to name the file uploading parameters unique.

curl -F "[email protected]" -F "[email protected]"  http://localhost:8888/web/Upload.php

This will show up in the $_FILES superglobal as $_FILES['image'] and $_FILES['image2'].

To make the files grouped under one $_FILES index you need to name the parameters as arrays:

curl -F "image[][email protected]" -F "image[][email protected]"  http://localhost:8888/web/Upload.php

Leave a Comment