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

前端 未结 5 1443
无人共我
无人共我 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:44

    Create the directory first using mkdir()

      $rand =  chr(rand(97, 122)). chr(rand(97, 122)). chr(rand(97, 122));
        mkdir('./uploades/'.$rand);
        if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], './uploades/'.$rand))
        die("success");
        else
        die("error");
    

提交回复
热议问题