douzhang1115 2013-08-09 10:34
浏览 32

图像上传后页面不重定向

page is not redirecting after image upload,it is working without any problem in localhost.

<?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;
    }
?>
  • 写回答

2条回答 默认 最新

  • douchi0638 2013-08-09 10:39
    关注

    Instead of writing this very complex quotes issue try minimizing the quotes

        header("location: sub_products.php?id=".$_POST['main_p_id']."");
    

    So use this instead of the above

        $val=$_POST['main_p_id'];
        header("Location:sub_products.php?id=$val");
    
    评论

报告相同问题?

悬赏问题

  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题