Okay so a few days ago I finished a tutorial of photo gallery...I'm having problems of putting images other than jpg format...the one who made the tutorial said that you can add formats to be uploaded but he didnt show it..here was his code in his upload.php...I tried experimenting on it but I cant get it to work properly..
<?php
error_reporting(0);
mysql_connect('localhost','root','');
mysql_select_db('uslt');
?>
<html>
<head>
<title>Album Gallery</title>
<link rel='stylesheet' href='style.css'>
</head>
<body>
<div id='body'>
<?php include('title_bar.php');?>
<div id='container'>
<h3>Upload Photos</h3>
<form enctype='multipart/form-data' method='post'>
<?php
if (isset($_POST['submit'])) {
$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 everything <br><br>";
}else{
move_uploaded_file($file_tmp,'uploads/'.$random_name. '.jpg');
mysql_query("INSERT into photos values('','$name','$album_id','$random_name.jpg')");
echo "Photo Uploaded!";
}
}
?>
Name: <br>
<input type='text' name='name'>
<br><br>
Select Album:<br>
<select name='album'>
<?php
$query=mysql_query("SELECT id, name from albums");
while ($run=mysql_fetch_array($query)) {
$album_id=$run['id'];
$album_name=$run['name'];
echo "<option value='$album_id'>$album_name</option>";
}
?>
</select>
<br><br>
Select Photo: <br/>
<input type='file' name='file'>
<br><br>
<input type='submit' name='submit' value='Upload'>
</form>
</div>
</div>
</body>
</html>