upload multiple files to php server using curl command line

后端 未结 2 2086
温柔的废话
温柔的废话 2020-12-03 03:29

I need to upload multiple files to a server using the curl command line utility. for a single file I have no problem using:

curl -F \"image=@file1.gif\"   ht         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-03 03:37

    The trick is to name the file uploading parameters unique.

    curl -F "image=@file1.gif" -F "image2=@file2.gif"  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[]=@file1.gif" -F "image[]=@file2.gif"  http://localhost:8888/web/Upload.php
    

提交回复
热议问题