解决方案 »

  1.   

    应该是这个$path写错了吧?  求助啊~!!!!
      

  2.   

    应该是$_SERVER["DOCUMENT_ROOT"]."/rlx/image/" 目录不存在
    你试试下面这个  看看打印什么信息  在贴出来看看<?
    if (empty($_FILES["photo"]["photo"]) && !empty($_FILES["photo"]["tmp_name"])) {    $newname = "123.jpg";    $basePath = $_SERVER["DOCUMENT_ROOT"] . "/rlx/image/";    if (file_exists($basePath)) {        $path = $basePath . $newname;
            $ret = move_uploaded_file($_FILES["photo"]["tmp_name"], $path);        if ($ret) {
                echo "Done";
            }
            else {
                echo "Move error";
            }
        }
        else {
            echo $basePath, "not exist.";    }
    }
    else {
        echo "error.";
        var_dump($_FILES);
    }
    ?>
      

  3.   


    写错了地方  
    empty($_FILES["photo"]["error"]) 
      

  4.   

    $path = $_SERVER["DOCUMENT_ROOT"]."/rlx/image/".$newname;
    //之后添加一句、需要创建目录的权限
    if(!file_exists($path)){
      mkdir($path,777,true);
    }
      

  5.   


    <?php
    date_default_timezone_set('prc');
    include("../../dbhelper.php");
    $name = $_FILES["photo"]["name"];
    $size = $_FILES["photo"]["size"]/1024;
    $content = $_REQUEST["content"];
    $type = strstr($name,".");
    $newname = date("ymd_His")."_".rand(10,99).$type;
    $path = $_SERVER["DOCUMENT_ROOT"]."/rlx/image/".$newname;
    if(!file_exists($path)){
      mkdir($path,777,true);
    }if(!preg_match("/JPG|GIF|PNG/i",$type))
    header("../location:msg.php?num=9");
    else if($size==0 || $size>2000)
    header("../location:msg.php?num=10");
    else
    {
    $dbhelper = new dbhelper();
    $dbhelper->open();
    $sql = "insert into image(src,content,time,flag) values ('image/$newname','$content',now(),2)";
    $result = mysql_query($sql);
    if($result==true)
    {
    move_uploaded_file($_FILES["photo"]["tmp_name"],$path);
    header("location:../msg.php?num=11");
    }
    else
    header("location:../msg.php?num=12");
    $dbhelper->close();
    }?>这是我的后台处理代码  帮我看看  求助~~
      

  6.   

    上传之后跳转到msg.php啊   
      

  7.   

    msg.php?num=9 ?
    msg.php?num=10?
    msg.php?num=11?
    msg.php?num=12?还msg.php啊!自己设置的状态都是摆设吗?
      

  8.   

    什么意思?我不懂啊。。初学者~~
    我的跳转到msg.php带一个num参数有问题吗?
    求详解  谢谢
      

  9.   

    file_exists那里应该判断
    $_SERVER["DOCUMENT_ROOT"]."/rlx/image/"
    是否存在
      

  10.   

    现在图片上传没问题了   原因是文件夹权限的问题
    但是不知道为什么header location 的跳转是“该页无法显示”
    这个事为什么?怎么不能跳转页面了呢?<?php
    date_default_timezone_set('prc');
    include("../../dbhelper.php");
    $name = $_FILES["photo"]["name"];
    $size = $_FILES["photo"]["size"]/1024;
    $type = strstr($name,".");
    $newname = date("ymd_His")."_".rand(10,99).$type;
    $path = $_SERVER["DOCUMENT_ROOT"]."/image/".$newname;
    if(!preg_match("/JPG|GIF|PNG/i",$type))
    header("location:../msg.php?num=9");
    else if($size==0 || $size>2000)
    header("location:../msg.php?num=10");
    else
    {
    $dbhelper = new dbhelper();
    $dbhelper->open();
    $sql = "insert into image(src,time,flag) values ('image/$newname',now(),0)";
    $result = mysql_query($sql);
    if($result==true)
    {
    move_uploaded_file($_FILES["photo"]["tmp_name"],$path);
    header("location:../msg.php?num=11");
    }
    else
    header("location:../msg.php?num=12");
    $dbhelper->close();
    }
    ?>
      

  11.   

    header location 的跳转是“该页无法显示”
    你打印出跳转的路径看看就知道问题了。
      

  12.   

    有个phpuploader 可以去参考下!