hi ive got a script that need to upload a photo for an item and display it.but the photo does not show up i get corrupted file instead here is the scrip for the upload part can someone tell me what is going wrong. the photo needs to be save in uploads/deal_images path
if(is_uploaded_file($_FILES['deal_image']['tmp_name']))
{
$tmp_file = $_FILES['deal_image']['tmp_name'];
$image_name=$_FILES['deal_image']['name'];
$filename = "../uploads/deal_images/".$image_name;
move_uploaded_file($tmp_file,$filename);
$thumb=new Thumbnail($filename); // Contructor and set source image file
$thumb->size_width(939); // [OPTIONAL] set width for thumbnail, or
$thumb->size_height(349); // [OPTIONAL] set height for thumbnail, or
$thumb->process();
$file_name = "../uploads/deal_images/thumb/".$image_name; // generate image
$status=$thumb->save($file_name); // save your thumbnail to file
$data['deal_image']=$image_name;
}
if($_REQUEST['mode']=="edit")
{
$deal_id=intval($_REQUEST['id']);
$db->query_update(TABLE_DEALS, $data, "deal_id='$deal_id'");
/*$seld="select * from ".TABLE_DEALS." where deal_id='$deal_id'";
$resd=mysql_query($seld);
$rowd=mysql_fetch_array($resd);
$fstat=$rowd['is_featured'];
$fcity=$rowd['city'];
if($fstat==1)
{
$ups="update ".TABLE_DEALS." set is_featured=0 where city='$fcity' and deal_id NOT IN ($deal_id) ";
mysql_query($ups);
} */
header("location:show_deals.php?msg=2");
}
else
{
$primary_id=$db->query_insert(TABLE_DEALS, $data);
/*$seld="select * from ".TABLE_DEALS." where deal_id='$primary_id'";
$resd=mysql_query($seld);
$rowd=mysql_fetch_array($resd);
$fstat=$rowd['is_featured'];
$fcity=$rowd['city'];
if($fstat==1)
{
$ups="update ".TABLE_DEALS." set is_featured=0 where city='$fcity' and deal_id NOT IN ($primary_id) ";
mysql_query($ups);
}*/
hope some one can help me out thanks