P粉1896062692023-08-22 11:11:35
Capture user id as path variable (recommended):
curl -i -X POST -H "Content-Type: multipart/form-data" -F "data=@test.mp3" http://mysuperserver/media/1234/upload/
Capture the user id as part of the form:
curl -i -X POST -H "Content-Type: multipart/form-data" -F "data=@test.mp3;userid=1234" http://mysuperserver/media/upload/
or:
curl -i -X POST -H "Content-Type: multipart/form-data" -F "data=@test.mp3" -F "userid=1234" http://mysuperserver/media/upload/
P粉6210339282023-08-22 00:18:22
You need to use the -F
option:
-F/--form <name=content> Specify HTTP multi-part POST data (H)
Please try the following:
curl \ -F "userid=1" \ -F "filecomment=这是一个图片文件" \ -F "image=@/home/user1/Desktop/test.jpg" \ localhost/uploader.php