So I have an image upload script. It uploads the image and saves it to the space on the server. What I can't seem to get my head around is say, when the user uploads a .png, by the time it saves on my server i want it to be a jpg.
Can anyone help with this, and please don't just direct me to another question as I havent had anything work yet. Here is an example of my code.
$name = addslashes($_FILES['image']['name']);
$ext = pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION);
$size = $_FILES['image']['size'];
$temp = $_FILES ['image']['tmp_name'];
$error = $_FILES ['image']['error'];
if ($error > 0)
die("Error uploading file! Code $error.");
else
if ($password == "" || $size > 2000000) {
move_uploaded_file($temp, $images.$name);
mysql_query("INSERT INTO image_approval VALUES ('','$description','','$images$name','',NOW())");
echo "Upload complete!";
}else{
echo "Error uploading file";
}