我有這種在php文件上傳錯誤。它讓我很難找到答案。當我檢索某個文件上傳的變量時,我無法檢索它。繼承我的代碼。我有這種錯誤在PHP
//this is the php code for validating all post and pass it to db
<?php
$id = $_SESSION['id'];
$pic = '';
$message = '';
if(isset($_POST['add']))
{
include_once('database.php');
_addstocks($_POST);
$message = 'New Stocks Record Added';
echo $_POST['ipic'];
}
function post_value($key)
{
if(isset($_POST[$key]))
echo htmlentities($_POST[$key]);
}
?>
//這是我的形式或使數據不能傳遞到分貝
<form class="modal-content container" style="width:445;" method="post" enctype="multipart/form-data" >
<br>
<label>Item Code</label><br>
<input type="text" name="icode" class="form-control" placeholder="Item Code" required autofocus><br>
<label>Item Name</label><br>
<input type="text" name="iname" class="form-control" placeholder="Item Name" required><br>
<label>Item Description</label><br>
<input type="text" name="idesc" class="form-control" placeholder="Item Description" required><br>
<!--<label>Item Type</label><br>-->
<input type="text" class="hidden" name="itype" value="perishable">
<label>Item Price</label><br>
<input type="text" name="iprice" placeholder="Item Price" class="form-control" required><br>
<label>Item Quantity</label><br>
<input type="text" name="iqty" placeholder="Item Quantity" class="form-control" required><br>
<input type="text" class="hidden" name="estabno" value="<?php echo "01";?>">
<div enctype="multipart/form-data">
<label>Upload Display Picture</label><br>
<label for="fileToUpload"><img src="photos/<?php echo $pic;?>" style="width:100px;height:100px"></label>
<input class=""type="file" name="ipic" id="fileToUpload"><br>
</div>
<input type="text" class="hidden" name="istat" value="available">
<?php echo htmlentities($message);?>
<input type="submit" name="add" value="Create" class="btn btn-success" style="float:right;" >
<br><br><br>
</form>
和這個數據庫,用於將股
function _addstocks($stocks)
{
$sql = "INSERT INTO inventory
(
itemcode,
itemname,
itemdesc,
itemcateg,
itemprice,
itempic,
estabno,
itemqty,
status
) VALUES (?,?,?,?,?,?,?,?,?)";
$db = database();
$st = $db->prepare($sql);
$st->execute(array(
$stocks['icode'],
$stocks['iname'],
$stocks['idesc'],
$stocks['itype'],
$stocks['iprice'],
$stocks['ipic'],
$stocks['estabno'],
$stocks['iqty'],
$stocks['istat'])
);
$db = null;
}
,這是錯誤我得到。 http://i.imgur.com/7M7l18j.png
什麼樣的錯誤?順便說一句,'['ipic']'是一個文件。 http://php.net/manual/en/function.error-reporting.php – 2015-02-08 03:29:25