dongshaoxiong0012 2015-01-22 15:11
浏览 50

mkdir()没有在linux服务器上创建文件夹

Right I had this working on my local server which was windows server 2012, however when hosting I am now on a linux server.

when the user submits the form it should run this code

Code:

$target_dir = "docs". "/";
//IF/ELSE the folder is already created...
    if(!file_exists($target_dir . $ref . "/"))
    {//Create folder named 1 inside the customer ref folder.
        mkdir($target_dir . $ref . "/" . "1" . "/", 0775, true);
        $count = 0;
    }else
    {//Create new folder inside customer ref folder 
        //count the amount of folders inside docs/$ref/
        $find_folders = glob($target_dir . $ref . "/" . "*",GLOB_ONLYDIR);
        $count = count($find_folders);
        //create new folder inside $ref/ using count+1 to make the folder increase by 1
            $new_folder = $count +1;
            mkdir($target_dir . $ref . "/" . $new_folder . "/", 0775, true);        
    }
            //IF count exists then the $target_file changes to the new folder...
                if($count > 0)
                    {
                        $target_file = $target_dir . $ref . "/" . $new_folder . "/";  
                    }else
                    {//else use first directory
                        $target_file = $target_dir . $ref . "/" . "1" . "/";
                    }

On my windows server every single "/" you see i was using DIRECTORY_SEPARATOR but asumed being linux it would need to be changed to a forward slash. This is now not working. Any dieas why?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 西门子S7-Graph,S7-300,梯形图
    • ¥50 用易语言http 访问不了网页
    • ¥50 safari浏览器fetch提交数据后数据丢失问题
    • ¥15 matlab不知道怎么改,求解答!!
    • ¥15 永磁直线电机的电流环pi调不出来
    • ¥15 用stata实现聚类的代码
    • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
    • ¥20 docker里部署springboot项目,访问不到扬声器
    • ¥15 netty整合springboot之后自动重连失效
    • ¥15 悬赏!微信开发者工具报错,求帮改