2014-04-04 3 views
1

왜 작동하지 않습니까? PHP를 사용하여 파일을 업로드하려고합니다. 문제의 파일은 파일 경로를 저장하기 만하면되는 이미지입니다. 이 코드를 사용하고 있지만 작동하지 않습니다. 어떤 도움이 필요합니까? 정의되지 않은 색인 :

<html> 
<body> 
<form action="book_create.php" method="POST"> 
title: <input type="text" name="title"/><br> 
authors: <input type="text" name="authors"/><br> 
description: <textarea type="text" name="description"></textarea><br> 
price: <input type="text" name="price"/><br> 
image: <input type="file" name="image"/><br> 
content: <input type="file" name="content"/><br> 
<input type="submit" value="book_create"/> 
</form> 
</body> 
</html> 

PHP의 : 아직 "이미지"를 사용 정의되지 않은 인덱스 오류가

if ($_FILES["image"]["error"] > 0) 
{ 
echo "Error: " . $_FILES["image"]["error"] . "<br>"; 
} 
else 
{ 
echo "Upload: " . $_FILES["image"]["name"] . "<br>"; 
echo "Type: " . $_FILES["image"]["type"] . "<br>"; 
echo "Size: " . ($_FILES["image"]["size"]/1024) . " kB<br>"; 
echo "Stored in: " . $_FILES["image"]["tmp_name"]; 
} 

보관할?

감사

답변

3

당신은 당신의 양식에 enctype 속성이 누락 : 당신은 당신의 폼 태그에 enctype="multipart/form-data"을 포함 할 필요가

<form action="book_create.php" method="POST" enctype="multipart/form-data">