我正在跟随一个教程学习如何从安卓上传图片到服务器,并且我在服务器端使用 PHP,以下是代码:
<?php
error_get_last();
chmod("./uploadedimages/", 777);
// Get image string posted from Android App
$base=$_REQUEST['image'];
// Get file name posted from Android App
$filename = $_REQUEST['filename'];
// Decode Image
$binary=base64_decode($base);
header('Content-Type: bitmap; charset=utf-8');
// Images will be saved under 'www/imgupload/uplodedimages' folder
$file = fopen('uploadedimages/'.$filename, 'wb');
// Create File
fwrite($file, $binary);
fclose($file);
echo 'Image upload complete, Please check your php file directory';
?>
当我尝试运行时,它显示以下错误:
我很新手,希望得到帮助(我从互联网上找到了一些答案,但对我没用)。fopen(uploadedimages/):无法打开流:在...中没有此类文件或目录
fwrite()期望参数1为资源,但给出了布尔值...
fclose()期望参数1为资源,但给出了布尔值...