Im having trouble uploading the picture to the folder. The pathway is correct and all the information of the form is sent correctly to the db, just no picture is actually getting uploaded. Im just lost.

/*imgsubmit.tpl*/
<form enctype="multipart/form-data"action="admin_site_approval.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="204800">
<input type="file" name="fupload" id="fupload" accept="image/jpg,image/gif" />
<input type="text" name="filename">

/*imgsubmit.php*/
if(!empty($fupload)) {
foreach($HTTP_POST_FILES as $file_name => $file_array) {
if (is_uploaded_file($file_array['tmp_name'])) {
$imginfo = getimagesize($file_array['tmp_name']);
if (in_array($imginfo[2], array(1, 2, 3))) {
if ($imginfo[2] == 1)
$upimage = imagecreatefromgif($file_array['tmp_name']);
elseif ($imginfo[2] == 2)
$upimage = imagecreatefromjpeg($file_array['tmp_name']);
else
$upimage = imagecreatefrompng($file_array['tmp_name']);

$newx = 50;
$newy = 70;

$newimg = imagecreateTrueColor($newx, $newy);
imagecopyresized($newimg, $upimage, 0, 0, 0, 0, $newx, $newy, imagesx($upimage), imagesy($upimage));
if(!empty($_POST['filename'])) {
if(imagejpeg($upimage, '/home/rofl/public_html/uploaded/'.trim($_POST['filename']).'.jpg')) {
echo "JPG File uploaded successfully<br>";
}else{
echo "ERROR! JPG File not uploaded<br>";
}
if(imagegif($newimg, '/home/rofl/public_html/uploaded/'.trim($_POST['filename']).'.gif')) {
echo "Thumbnail (".$_POST['filename'].") uploaded successfully<br>";
}else{
echo "ERROR! Thumbnail (".$_POST['filename'].") not uploaded<br>";
}
}else{
$message .= 'Image not saved due to lack of image name<br />';
}
}
}
}
}