How to create destination (Folder) in PHP while using move_uploaded_file()?

前端 未结 5 1420
无人共我
无人共我 2020-12-29 06:41

I want to upload files with PHP and i use move_uplload_files to copy them to the destination folder I want, everything works fine with this :

if (move_upload         


        
5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-29 07:34

    Use mkdir().

    If you need to make multiple folders, such as by passing a/b/c, set the third argument to TRUE.

    You can test if it is already there, and add if not like so....

    $path = 'abc';
    
    if ( ! is_dir($path)) {
        mkdir($path);
    }
    

提交回复
热议问题