안녕하세요, 일부 웹 예제 다음 이미지를로드하는 폼을 만들려고하지만로드 할 이미지를 가져올 수 없습니다. 아파치를 실행중인 개인 페도라 박스에서 일하고 있습니다. 아파치와 다른 설정이 필요합니까? 여기에 업로드 이미지해야 내 양식 스크립트입니다 :html form enctype = multipart/form-data
<form name ="input" enctype="multipart/form-data" action = "addPhotograph.php" method = "get">
<table>
<tr>
<th>Title:</th> <td><input type="text" name ="photoname"></td>
</tr>
<tr>
<th>Photograph:</th> <td><input type="file" id="file" name="file" accept="image/*"></td>
</tr>
<tr>
<th>Photographer:</th><td><input type="" name="photographer"></td>
</tr>
<tr>
<th>Genre:</th><td><input type = "" name="genre"></td>
</tr>
<table>
<input type="submit" value = "Submit">
</form>
을 그리고 여기 내 PHP 스크립트입니다 :
<?php
$uploaddir = '/var/www/html/photodb';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['file']['name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
나는 양식을 통해 이미지를 추가하면 PHP는 양식은 "파일 업로드 공격의 가능성이 말하는 실패! " 파일을 옮기지 못했거나 파일을 업로드하지 못했다는 의미입니까?
저는 대학 과제를 위해 어떤 반응이나 다른 생각을하고 있습니다. :)
'$ uploaddir = '/ var/www/html/photodb /'; '을 시도해보십시오. 보안을 강화해야하지만 아무것도 업로드하지 않으셔도됩니다. –