I am trying to rename a file that is being uploaded from a form.
The code I am using to upload the file is
<?
// this starts the session
session_start();
// this pulls input variables from the session form
$_SESSION['id'] = $_POST['id'];
?>
<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/bmp")
|| ($_FILES["file"]["type"] == "image/tiff")
))
{
move_uploaded_file($_FILES['file']['tmp_name'], "files/" . $_FILES['file']['name']);
echo "Your image has been uploaded";
}
else
{
echo "Invalid file";
}
?>
But I need to be able to rename the file to the 'id' pulled in form the form.
Thanks,
George