简体   繁体   中英

php glob function is not working when directory is created using mkdir function

I am creating folders using php. When I use php's glob function on a directory it does not return anything. If I create a folder manually in same directory then glob works fine.

Code:

$uploaded_files_location = "../propertyImages/".$LastId."/";
echo $uploaded_files_location;
  if (file_exists($uploaded_files_location))
   {
} 
else 
{
    mkdir($uploaded_files_location);
}

To get files from directory I am using this:

Code:

$dir = "../propertyImages/".$id."";
$files = glob("$dir/*.*");
print_r($files);

Have you tried change chmod of folder and files in it?

Try this:

mkdir($uploaded_files_location, 0777);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM