$file是一个数组的,print_r($file); 看看这个数组的结构,你就明白了

解决方案 »

  1.   

    正好,借你的帖子请人帮我改程序,哪里错了帮我改改,我看不出来
    ************************************
    upload.php3
    <html>
    <head>
    <title>
    Upload Your File</title>
    </head>
    <body>
    <form acction ="receiver.php3" enctype="multipart/form-data" METHOD=POST>
    <input type ="hidden" name="MAX_FILE_SIZE" value="2000000">
    <input type ="file" name="uploadfile" size="32" maxlength="80">
    <input type="submit" value="Upload File!" name="sendit">
    <input type="submit" value="cancel" name="cancelit"><br>
    </form>
    </body>
    </html> 
     /*receiver.php3*/
    <?
    function do_upload()
    {
    global $uploadfile, $uploadfile_size;
    global $local_file,$error_msg;
    if($uploadfile=="none")
    {
    $error_msg="对不起,你没有选定任何文件上传!";
    return;
    }
    if($uploadfile_size >2000000)
    {
    $error_msg="对不起,你要上传的文件太大了";
    return;
    }
    $the_time=time();
    $upload_dir="c:/web/upload";
    $local_file="$upload_dir/$the_time";
    if(file_exits('$local_file'))
    {
    $seq=1;
    while(file_exits("$upload_dir/$the_time$seq"))
    {$seq++;}
    $local_file="$upload_dir/$the_time$seq";
    };
    rename($uploadfile,$local_file);
    display_page();
    }
    display_page();function display_page()

    //这是你的页面内容
    }
    ?><html>
    <head>
    <title>php3 receiving script</title>
    </head>
    <body>
    <?if ($error_msg){echo "<b>$error_msg</b><br><br>";}
    if($sendit)
    {
    do_upload();
    echo "文件上传成功!";
    elseif($cancelit)

    Header("Location:$some_other_script");
    echo "文件上载失败!";
    exit;
    }
    else
    {some_other_func();
    }
    ?>
    </body>
    </html>
      

  2.   

    我这里有个小程序,可以运行的 ,PHP手册上下的
    /*test.php*/
    <form enctype="multipart/form-data" action="save.php" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="30000">
    Send this file: <input name="userfile" type="file">
    <input type="submit" value="Send File">
    </form>/*save.php*/
    <?php
    // 在 4.1.0 以前的 PHP 中,需要用 $HTTP_POST_FILES 代替 $_FILES。
    // 在 4.0.3 以前的 PHP 中,需要用 copy() 和 is_uploaded_file() 来代替 move_uploaded_file()。$uploaddir = '/var/www/uploads/';
    $uploadfile = $uploaddir. $_FILES['userfile']['name'];
    print "<pre>";
    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_FILES['userfile']['name'])) {
        print "File is valid, and was successfully uploaded.  Here's some more debugging info:\n";
        print_r($_FILES);
    } else {
        print "Possible file upload attack!  Here's some debugging info:\n";
        print_r($_FILES);
    }
    print "</pre>";
    ?>你看下你的PHP版本是多少的
      

  3.   

    这个问题网上有很多的。本站的FAQ里面
    phpx的精华里面自己去找一下吧!!!
      

  4.   

    http://www.phpx.com/happy/brd4.html精华里面
      

  5.   

    用 remove_upload_filecopy 可能会有权限问题