The if statement is not running .It works fine with the tutorial I have followed but when i have implemented it in my code it fails.The error is Undefined index: thumbnailPic,
The HTML code is :
<label >Thumbnail Picture<text>*</text></label><br>
<input type="file" name="thumbnailPic" id="pic"><br>
<label >Original Picture<text>*</text></label><br>
<input type="file" name="originalPic" id="pic"><br>
The PHP code is :
if (is_uploaded_file($_FILES['thumbnailPic']['tmp_name']) != false) {
$spID="NULL";
$Quant=$_POST['quantity'];
$Siz=$_POST['Size'];
$imgfp = fopen($_FILES['thumbnailPic']['tmp_name'],'rb');
$stmt = $connection->prepare("INSERT INTO stitchedproduct(sp_id,quantity,size,p_id,color_id,sp_thumbnail,sp_OriginalPic) VALUES (? ,?, ?, ?,?,?,?)");
$stmt->bindParam(1, $spID);
$stmt->bindParam(2, $Quant);
$stmt->bindParam(3, $Siz);
$stmt->bindParam(4, $ProductID);
$stmt->bindParam(5, $colour);
$stmt->bindParam(6, $imgfp);
$stmt->bindParam(7, $imgfp);
$stmt->execute();
}
else
echo "Error uploading image";
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…