任何人都可以幫助我在學校的任務,我困惑的是,圖像不能存儲到數據庫。如何上傳圖像到數據庫使用php,undefined索引:圖像
<form action="doOrder.php" method="post" enctype="multipart/form-data">
Category : T-SHIRT
Choose Size
<label for="sizes"><span>
<input type="radio" name="sizes" value="S" checked="checked"/>S
<input type="radio" name="sizes" value="M" />M
<input type="radio" name="sizes" value="L" />L
<input type="radio" name="sizes" value="XL" />XL
</span>
</label>
Fabric Type
<select name="fabric">
<option value="Cotton Combed">Cotton Combed</option>
<option value="Cotton Carded">Cotton Carded</option>
<option value="Polyester/PE">Polyester/PE</option>
</select>
Total
<input type="number" name="total" min="1" max="100">
<input type="file" name="imageUpload" id="imageUpload">
<input value="Submit" type="submit" name="submit">
</form>
和這個doOrder.php
<?php
require_once("connect.php");
$nama_file = $_FILES['images']['name'];
$sizes = $_POST['sizes'];
$fabric = $_POST['fabric'];
$total = $_POST['total'];
move_uploaded_file($_FILES['images']['tmp_name'], "images/".$_FILES['images']['name']);
$simpan = mysql_query("INSERT INTO pesanan(category, sizes, fabric, total,images) VALUES('T-SHIRT','$sizes','$fabric','$total','$nama_file')");
echo "Your add has been submited....";
?>
誤差是
說明:未定義指數:在第4行的通知圖像:未定義指數: 圖像中的線9注意:未定義索引:在線9圖像
你''具有'名稱= 「imageUpload」',爲什麼你在PHP中將其稱爲'$ _FILES ['images']'? – Styx