使用curl上傳帶有文件的POST數(shù)據(jù)我想使用cURL不僅可以在HTTP POST中發(fā)送數(shù)據(jù)參數(shù),還可以上傳具有特定表單名稱的文件。我應該怎么做呢?HTTP Post參數(shù):userid = 12345 filecomment =這是一個圖像文件HTTP文件上傳:文件位置= /home/user1/Desktop/test.jpg file = image的表單名稱(對應于PHP端的$ _FILES ['image'])我認為cURL命令的一部分如下:curl -d "userid=1&filecomment=This is an image file" --data-binary @"/home/user1/Desktop/test.jpg" localhost/uploader.php我得到的問題如下:Notice: Undefined index: image in /var/www/uploader.php問題是我使用$ _FILES ['image']來獲取PHP腳本中的文件。如何相應調(diào)整cURL命令?
使用curl上傳帶有文件的POST數(shù)據(jù)
慕仙森
2019-08-14 17:15:21