图片上传后页面没有重定向,它在本地主机中正常工作。
<?php
if(! empty($_FILES["img"]["name"]))
{
include("config.php");
$temp=pathinfo($_FILES["img"]["name"]);
$ext=strtolower( $temp["extension"]);
$file_nm=time()."_chiragexport.".$ext;
move_uploaded_file($_FILES["img"]["tmp_name"],"../uploads/".$file_nm);
//convert size
include('includes/resize.php');
$image = new SimpleImage();
$image->load('../uploads/'.$file_nm);
$image->resize(250,250);
$image->save('../uploads/small/'.$file_nm);
//product code---------------------
$code1=rand(1000,9999);
$a="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$code=substr($a,rand(0,51),2).$code1;
$q="insert into sub_products(sub_main_p_id,sub_p_nm,sub_p_img,sub_p_small_img,sub_p_code)
values
('".$_POST['main_p_id']."', '".$_POST['sub_p_nm']."', 'uploads/".$file_nm."' ,'uploads/small/".$file_nm."','".$code."' )";
mysql_query($q);
header("location: sub_products.php?id=".$_POST['main_p_id']."");
}
else
{
header("location: sub_products.php?id=".$_POST['main_p_id']."");
exit;
}
?>