hi i have followed a online tutorial to replace photo system on my site and all went well till i attempt to upload photo i get no file selected even if i have just gone on the page but after pressing submit i get a success message and the photo goes to the database and in th euploads folder but it doesnt show on the album page can someone check this out as ive been through tutorial twice and there are no comments about this problem my upload code is
<form enctype="multipart/form-data" method="post"> <?php
if (isset($_POST['upload'])) {
$name = $_POST['name'];
$album_id = $_POST['album'];
$file = $_FILES['file']['name'];
$file_type = $_FILES['file']['type'];
$file_size = $_FILES['file']['size'];
$file_tmp = $_FILES['file']['tmp_name'];
$random_name = rand();
if (empty($name) or empty($file)) {
echo " please Fill in all fields ! <br/><br/>";
} else {
move_uploaded_file($file_tmp, 'uploads/'.$random_name.'.jpg');
mysqli_query($mysqli,"INSERT INTO photos VALUES('', '$name', '$album_id', '$random_name.jpg')");
echo "Photo Uploaded ! <br/><br/>";
}
}
?>
Select Photo</td><td><input type="file" accept="image/jpeg" name="file"/> <input type="submit" name="upload" value="Upload Photo"/>
and my album code is
<?php
$query = mysqli_query($mysqli,"SELECT `id`, `name` FROM `albums`");
while($run = mysqli_fetch_array($query)) {
$album_id = $run['id'];
$album_name = $run['name'];
$query1 = mysqli_query($mysqli,"SELECT `url` FROM `photos` WHERE `album_id`='$album'");
$run1 = mysqli_fetch_array($query1);
$pic = $run1['url'];
?> <a href='view.php?id=<?php echo $album_id; ?>'> <div id='view_box'> <img src='uploads/<?php echo $pic; ?>'/> <br/> <b><?php echo $album_name ?></b> </div> </a> <?php
}
?>
any help would be much appreicated ty all x