用PHP,文件夹是不能传上去的,

解决方案 »

  1.   

    <?php 
    /************************************* 
    * 系统名称:模拟xcopy的类 
    * 程序功能:模拟xcopy的类 
    * 开发日期:2003/03/14 
    *************************************/ 
    ?> 
    <? 
    //copy a direction’s all files to another direction 
    function xCopy($source, $destination, $child){ 
    //用法: 
    // xCopy("feiy","feiy2",1):拷贝feiy下的文件到 feiy2,包括子目录 
    // xCopy("feiy","feiy2",0):拷贝feiy下的文件到 feiy2,不包括子目录 
    //参数说明: 
    // $source:源目录名 
    // $destination:目的目录名 
    // $child:复制时,是不是包含的子目录 
    if(!is_dir($source)){ 
    echo("Error:the $source is not a direction!"); 
    return 0; 

    if(!is_dir($destination)){ 
    mkdir($destination,0777); 

    $handle=dir($source); 
    while($entry=$handle->read()) { 
    if(($entry!=".")&&($entry!="..")){ 
    if(is_dir($source."/".$entry)){ 
    if($child) 
    xCopy($source."/".$entry,$destination."/".$entry,$child); 

    else{ copy($source."/".$entry,$destination."/".$entry); 
    } } 
    } return 1; 
    } ?>
      

  2.   

    $FileCount = 0; //文件个数
    $DirectoryCount = 0; //目录个数
    function FCount($Path)
    {
    global $FileCount,$DirectoryCount;
        $Handle = opendir($Path);
        while($File = readdir($Handle))
        {
            if(filetype($Path.$File) != 'dir')
            {
                echo "----文件名----$File<br/>";
                $FileCount++;
            }
            if($File !='.' && $File !='..' && filetype($Path.$File)=='dir')
            {
                echo "目录名----$File<br/>";
                $DirectoryCount++;
                FCount($Path."$File/");
            }
        }
        closedir($Handle);
    }
    FCount('./upfiles/');
    echo "<br/>目录个数……………………$DirectoryCount<br/>----文件个数……………………$FileCount<br/>";
      

  3.   

    多谢“sandyuk(冰の沙隆) ”大哥!!!
    我试试!!!我找到高手啦!!!以后我就不怕了!!!嘿嘿!
      

  4.   

    //LeeMaRS(乐天派的小菜虎) 你是说把文件读出来后,再排序,哦!是先读至数组中,再用数组排序吗???我试试!!!我的文件名是有规律,我也是这样想的,用程序生成统一的文件名!
      

  5.   

    allkill(傲气游) 说得对, 我和你的看法是一致的.
      

  6.   

    to //allkill(傲气游) 
    对!先压缩是个好办法!!!所有问题就全解决了!!!
    嘿嘿!!!如果哪位有更好的办法请告诉我!!!谢谢!!!多谢各位大哥帮忙!!!
      

  7.   

    还不如直接开FTP呢, 呵呵.
      

  8.   

    咦!!!
    我们是程序员吗???要尽量让用户操作简单,傻瓜式吗!!!看着他们说我的程序方便、好用是很幸福的呀!!!哈哈!!!我仔细看了一下“sandyuk(冰の沙隆) ”的回复,好像是在服务器端运行的,能把文件夹传上去吗???看来我只能用ZIP包传了!!!
      

  9.   

    为什么我用打开zip文件出错???
    提示
    Warning: zip_open() Cannot open zip archive test.zip in D:\modify_new\test.php on line 2我在phpinfo里看见我的zip已经出现了!!!还要配什么吗???