上传后,我根据应用程序ID创建文件夹,该文件夹是唯一的。
我在这里面临的问题是,一旦我上传,文件就会被人们所尊重的文件夹上传。
甚至创建了文件夹。
任何人都可以帮忙!!!
$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 :(得分:2)
Remove extra /
between est_collaboration/Files/'
And .$send_id
.
Append /
in last. Like
$path_user = '/home/devestctrl/public_html/wp-content/plugins/est_collaboration/Files/'.$send_id.'/';
答案 1 :(得分: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";
}