我試圖做一個文件上傳系統,無論何時上傳文件,文件進入上傳文件夾設置像這樣上傳/ 2012/09/{randomhash} /。如何使動態更改上傳路徑
爲此,我嘗試了下面的代碼。
$hash = RandomString(20);
$upload_path = '../../uploads/'.$year.'/'.$month.'/'.$hash.'/';
if (!is_dir($upload_path))
{
mkdir($upload_path, 0777);
}
由於某種原因,它不工作,我不知道爲什麼。
感謝這個作品 – leanswag