Using a very simple PHP server:
<?php
$file = date("YmdHisms") . ".jpg";
file_put_contents($file, file_get_contents("php://input"));
?>
I'm trying to upload images using cURL:
curl --data "/path/to/image.jpg" 'http://192.168.1.3'
or:
upload multiple files to php server using curl command line
curl -F "image=@image.jpg" 'http://192.168.1.3'
or:
cat image.jpg | curl --data - 'http://192.168.1.3'
Files are getting created in my web sever directory, but the images don't seem to open? What am I getting wrong here?
Change the php code to
<?php
$file = date("YmdHisms") . ".jpg";
move_uploaded_file($_FILES['image']['tmp_name'], $file);
?>
尝试这个:
curl -i -X POST -H "Content-Type: multipart/form-data" -F "image=@image.jpg" http://192.168.1.3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.