2016-05-17 26 views
1

一旦上傳,我將根據獨特的應用程序標識創建文件夾。php-如何將文件移動到使用用戶標識創建的文件夾(上傳文件)

我在這裏面臨的問題是,一旦我上傳,文件正在upwardade側受尊重的文件夾。

甚至文件夾正在創建。

任何人都可以幫助!

$path = $file['name']; 
$path_user = '/home/devestctrl/public_html/wp-content/plugins/est_collaboration/Files/'.'/'.$send_id; 
if (!file_exists($path_user)) { 
    if (mkdir($path_user,0766,false)) { 
     if (move_uploaded_file($file['tmp_name'],$path_user.$path)) { 
      echo"inside 2"."<br>"; 
      echo"Your File Successfully Uploaded"; 
     }     
    } 
} 
+0

'出方尊重folders.'手段? –

+0

@NanaPartykar外部應用程序ID – JMR

+0

$ path_user ='/home/devestctrl/public_html/wp-content/plugins/est_collaboration/Files/'.'/'.'sesend_id.'/';加上最後的斜槓 – JYoThI

回答

2

​​而.$send_id之間移除額外/

最後追加/。像

$path_user = '/home/devestctrl/public_html/wp-content/plugins/est_collaboration/Files/'.$send_id.'/';

0

您需要添加$path_user$path之間的斜線:

$path_user = '/home/devestctrl/public_html/wp-content/plugins/est_collaboration/Files/'.'/'.$send_id; 
if (!is_dir($path_user)) { 
    if (!mkdir($path_user, 0766, false)) { 
     die('Directory cannot be created'); // handle this exception 
    } 
} 

if (move_uploaded_file($file['tmp_name'], $path_user . '/' . $path)) { 
// ----- You are missing this slash -------------------^^^------------ 
    echo "inside 2"."<br>"; 
    echo "Your File Successfully Uploaded"; 
} 
相關問題