使用cURL将图像上传到PHP服务器?
使用非常简单的PHP服务器:使用cURL将图像上传到PHP服务器?,php,curl,server,debian,ubuntu-16.04,Php,Curl,Server,Debian,Ubuntu 16.04,使用非常简单的PHP服务器: <?php $file = date("YmdHisms") . ".jpg"; file_put_contents($file, file_get_contents("php://input")); ?> 或: 或: 正在我的web服务器目录中创建文件,但图像似乎没有打开?我这里出了什么问题?试试这个: curl -i -X POST -H "Content-Type: multipart/form-data" -F "image=@image.j
<?php
$file = date("YmdHisms") . ".jpg";
file_put_contents($file, file_get_contents("php://input"));
?>
或:
或:
正在我的web服务器目录中创建文件,但图像似乎没有打开?我这里出了什么问题?试试这个:
curl -i -X POST -H "Content-Type: multipart/form-data" -F "image=@image.jpg" http://192.168.1.3
将php代码更改为
<?php
$file = date("YmdHisms") . ".jpg";
move_uploaded_file($_FILES['image']['tmp_name'], $file);
?>
cat image.jpg | curl --data - 'http://192.168.1.3'
curl -i -X POST -H "Content-Type: multipart/form-data" -F "image=@image.jpg" http://192.168.1.3
<?php
$file = date("YmdHisms") . ".jpg";
move_uploaded_file($_FILES['image']['tmp_name'], $file);
?>