I want to set a directory path but my folder on desktop so in case if i host a my app how it will take automaticaly that path here is my code
$src = 'C:\Users\Nikhil.Chakor\Desktop/test/';
$test = Get_ImagesToFolder1($src);
function Get_ImagesToFolder1($src){
$ImagesArray = [];
$file_display = [ 'jpg', 'jpeg'];
if (file_exists($src) == false) {
return ["Directory \'', $src, '\' not found!"];
} else {
$dir_contents = scandir($src);
foreach ($dir_contents as $file) {
$file_type = pathinfo($file, PATHINFO_EXTENSION);
if (in_array($file_type, $file_display) == true) {
$ImagesArray[] = $file;
}
}
return $ImagesArray;
}
}