Script #1 resizes uploaded images and saves them to my "newphotos" folder as "resized.jpeg" or any other name I choose.

Script #2 does the same thing but names the uploaded image with the user's name from the input form.

I need to know which photo goes with which user, but can't get script #2 integrated properly into script #1. I've tried replacing $image->save in Script #1 with the move function from Script #2 with all sorts of variations with no success.

I'm just learning PHP code so any help coming my way would be very appreciated. Thanks,


Script #1

if( isset($_POST['submit']))
$image = new SimpleImage();
header('Location: 3.alumni.success.php');

Script #2

if ($_FILES["file"]["error"] > 0) {
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
} else {
move_uploaded_file($_FILES["file"]["tmp_name"], "newphotos/{$_POST['lastname']}.{$_POST['firstname']}.jpeg");

<div style="margin-top:100px; text-align:center;">
<form method="POST" enctype="multipart/form-data">
<input type="file" name="file"><br /><br />
First Name<input type="text" name="firstname"><br />
Last Name <input type="text" name="lastname"><br /><br />
<input type="submit" value="submit">