您试图创建一个网站,让用户上传或从相机拍照,我尝试使用的是接受="图像/ *"我在互联网上找到了。
这是我的html文件
<!DOCTYPE html>
<html>
<head>
<title>Take Photo</title>
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="uploadedfile" accept="image/*" capture>
<input type="submit" value="Upload">
</form>
</body>
</html>
这是我的upload.php文件
<?php
$target_path = "filecheck/check/takephoto/img/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
问题在于我收到此错误
警告:move_uploaded_file(takephoto / img / panda-010.jpg):无法打开流:第6行/home1/filecheck/check/takephoto/upload.php中没有此类文件或目录
警告:move_uploaded_file():无法移动&#39; / tmp / phpz3tKo0&#39; to&#39; filecheck / check / takephoto / img / panda-010.jpg&#39;在第6行的/home1/filecheck/check/takephoto/upload.php中 上传文件时出错,请重试!
如何将图片上传到img文件夹。 我是新人。