관리자가 서버에 이미지를 업로드하고 제품 ID.jpg의 이름으로 새 제품을 만들려고 할 때입니다. 나는 결과가 Google 검색했습니다. 코드가 옳은 것 같습니다. 누군가 나를 기쁘게 도와 줄 수 있습니까? 램프를 로컬 테스트 서버로 사용하고 있습니다.Upload File Image to server 오류
<?php
// Parse the form data and add inventory item to the system
if (isset($_POST['product_name'])) {
$product_name = mysql_real_escape_string($_POST['product_name']);
$price = mysql_real_escape_string($_POST['price']);
$details = mysql_real_escape_string($_POST['details']);
$category = mysql_real_escape_string($_POST['category_choice']);
$condition= mysql_real_escape_string($_POST['condition']);
$supplier_choice= mysql_real_escape_string($_POST['supplier_choice']);
$handling_time= mysql_real_escape_string($_POST['handling_time']);
$weight= mysql_real_escape_string($_POST['weight']);
$information_box= $_POST['information'];
$pid = mysql_insert_id();
// Place image in the folder
$newname = "$pid.jpg";
move_uploaded_file($_FILES['my_photo']['tmp_name'], "../inventory_images/$newname");
header("location: products.php");
exit();
}
?>
<form action="add_product.php" enctype="multipart/form-data" name="my_Form" id="my_Form" method="post">
<tr>
<td>Φωτογραφία</td>
<td>
<label>
<input type="file" name="my_photo" id="my_photo"/>
</label>
</td>
</tr>
<tr>
<td> </td>
<td>
<label>
<input type="submit" name="button" id="button" value="Αποθήκευση" />
</label>
</td>
</tr>
</table>
</form>
이미지를 옮길 폴더에 스크립트 쓰기 권한을 부여 했습니까? – ppp
mysql_real_escape_string을 너무 많이 사용하면 다른 사람이 PHP 파일을 업로드해도 상관하지 않습니까? 'var_dump ($ _ FILES [ 'my_photo'] [ 'error'])'는 무엇이라고 말합니까? –
어떻게 내 폴더에 내 PHP 권한을 부여 할 수 있습니까 ?? – JimmyV