我的代码如下所示:
do
{
$rand = rand(1,10000000);
$name_of_file_clear = $rand ;
$name_of_file = $rand . '.JPG' ;
$name_of_file_t = $rand . '_t.JPG' ; // for thubnsdffafasf
$this_directory_path = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']);
$images_directory_path = $_SERVER['DOCUMENT_ROOT'] . $this_directory_path . 'img/' . $name_of_file_clear . '/';
$whole_path = $images_directory_path.$name_of_file;
} while (file_exists($whole_path));
mkdir($images_directory_path, 777);
chmod($images_directory_path, 777);
move_uploaded_file($temp_file_name, $whole_path);
问题是,当我尝试上传文件时,文件未上传。我认为这个问题与权限有关。请帮帮我,我是php的新手。
答案 0 :(得分:5)
你用十进制指定它们。请尝试在八进制中指定它们。
mkdir($images_directory_path, 0777);