i have <input type="file" name="filetoupload">.
When i submit my page its work fine on my local computer.
but on web server it's like file is not opening. $image is empty.
if ($_POST)
{
$userfile = $filetoupload;
$image = fread(fopen($userfile, "r"), filesize($userfile));
$type = "image/pjpeg";
//Set a maximum height and width
$width = 800;
$height = 600;
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($userfile);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromstring($image);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
ob_start();
imagejpeg($image_p, '', 100);
$image_string = ob_get_contents();
ob_end_clean();
$image_string = addslashes($image_string);
$query = "INSERT into filebin (BType, BDesc, BBinary) VALUES ('$type', '$note', '$image_string')";
$result = mysql_query($query);
$imgid = mysql_insert_id();