Forum Moderators: coopster
$file_realname = trim($_FILES['image']['name']);
$extension = strrchr($file_realname, '.'); //this varibale contain the extension in the form: .EXT (with dot)
$productNum = "12345";
$new_name = $productNum . $extension; //you have to add the extension to the new name...
if (move_uploaded_file($_FILES['image']['tmp_name'], $uploaddir . $new_name))
{
echo $file_realname." has been uploaded and was renamed to" .$new_name;
}
else
{
echo "Error in uploading! File selected may be invalid or it is too big for uploading.<br>Please choose a file within the filesize limit of 1MB.";
}
And how do I limit the type of files the user is able to upload?