Files not being uploaded in dynamically created folders/subfolders

血红的双手。 提交于 2019-12-08 18:55:28

Try this,

Replace

 $target_path = 'uploads/'.$results; 

into

$target_path = $dirPath.'/';

Otherwise,

$target_path = $dirPath .'/'. basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}

Where is $results defined? You are using it here:

$target_path = 'uploads/'.$results;

Why?

Also, $result is the true or false return of mkdir() so you can't use that one either.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!