Heyy..我正在使用 php 脚本从 android 应用程序上传图像文件。我使用 HTTP Post 函数上传文件(我调用 www.masterstroketech.org/postimage.php?fn=abc.png 然后发布图像路径)。该文件正在服务器上创建,但其大小为 0 字节。
如果我在 000webhost.com 的免费服务器上使用相同的脚本,那么该脚本运行良好。究竟是什么问题?
php代码如下:
<?PHP
$data = file_get_contents('php://input');
if (!(file_put_contents($_GET['fn'],$data) === FALSE)) echo "File xfer completed."; // file could be empty, though
else echo "File xfer failed.";
?>