I am trying to upload some pictures through PHP and MYSQL, I am sending by means of a for the images from a form, to receive them is where I imagine my error is, any help I appreciate it.
<div class="modal fade" id="addphoto_<?php echo $pid; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<center><h4 class="modal-title" id="myModalLabel">Edit Product</h4></center>
</div>
<div class="modal-body">
<div class="container-fluid">
<?php
$a=mysqli_query($conn,"select * from product left join category on category.categoryid=product.categoryid left join supplier on supplier.userid=product.supplierid where productid='$pid'");
$b=mysqli_fetch_array($a);
?>
<div style="height:10px;"></div>
<form role="form" method="POST" action="addphoto.php<?php echo '?id='.$pid; ?>" enctype="multipart/form-data">
<?php
for ($i = 0; $i < 5; $i++) {
print '<div style="height:10px;"></div>
<div class="form-group input-group">
<span class="input-group-addon" style="width:120px;">Photo:</span>
<input type="file" style="width:400px;" class="form-control" name="image">
</div>';
}
?>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-times"></i> Cancel</button>
<button type="submit" class="btn btn-success"><i class="fa fa-check-square-o"></i> Add Photo</button>
</form>
</div>
</div>
</div>
</div>
and this would be the addphoto.php
<?php
include('session.php');
function addphoto (array $fileInfo = PATHINFO($_FILES["image"]["name"])){
$result = array();
}
$id=$_POST['id'];
while (array =! empty($_FILES["image"]["name"])){
if ($fileInfo['extension'] == "jpg" OR $fileInfo['extension'] == "png") {
$newFilename = $fileInfo['filename'] . "_" . time() . "." . $fileInfo['extension'];
move_uploaded_file($_FILES["image"]["tmp_name"], "../upload/" . $newFilename);
$location = "upload/" . $newFilename;
}
else{
$location="";
?>
<script>
window.alert('Photo not added. Please upload JPG or PNG photo only!');
</script>
<?php
}
mysqli_query($conn,"insert into carousel (productid,photo) values ('$id','$location')");
?>
<script>
window.alert('Product added successfully!');
window.history.back();
</script>
<?php
? >
}
I miss this error:
Parse error: syntax error, unexpected '(', expecting ')' in C: \ xampp \ htdocs \ FCH-master \ POS \ admin \ addphoto.php on line 3
Thank you very much for the help.