Parse error: syntax error, unexpected ')' in /home/sites/thedaffodilsociety.com/public_html/testbox.php on line 57
Can anyone see what the problem might be? This is the code:
Code: Select all
<?php
error_reporting(0);
$uploadDir = '/home/sites/mydomain.com/public_html/images/new/';
$max_width = 150;
$max_height = 150;
$upfile = $image; //$_FILES['upfile']['tmp_name');
$size = getimagesize($upfile);
//print_r($upfile);
$width = $size[0];
$height = $size[1];
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if( ($width <= $max_width) && ($height <= $max_height) )
{
$tn_width = $width;
$tn_height = $height;
}
elseif (($x_ratio * $height) < $max_height)
{
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}
else
{
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
$src = imagecreatefromjpeg($upfile);
$dst = imagecreatetruecolor($tn_width, $tn_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
imagepng($dst);
imagedestroy($src);
imagedestroy($dst);
if(isset($_POST['upload']))
{
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];
$member = $_POST['txtMember'];
$role = $_POST['txtRole'];
$filePath = $uploadDir . $fileName;
$result = move_uploaded_file($tmpName, $filePath,);
if (!$result) {
echo "Error uploading file";
exit;
}
include 'library/config.php';
include 'library/opendb.php';
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
$filePath = addslashes($filePath);
}
$query = "INSERT INTO upload2 (name, size, type, path, member, role ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$filePath', '$member', '$role')";
mysql_query($query) or die('Error, query failed : ' . mysql_error());
include 'library/closedb.php';
echo "<br>Files uploaded<br>";
}
?>
<form method="post" enctype="multipart/form-data">
<table width="350" border="0" cellpadding="1" cellspacing="1" class="box">
<tr>
<td width="246">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
<input name="userfile" type="file" id="userfile">
<input name="txtMember" type="text" id="txtMember" size="40" maxlength="50">
<input name="txtRole" type="text" id="txtRole" size="40" maxlength="50">
</td>
<td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td>
</tr>
</table>
</form>