How can i get a php script to get the first file in a folder, and then making a variable that file name (without the extension, but i know that biyt 😉 )
$path = "/path/to/directory/"; chdir($path); $main = opendir($path);
while($file = readdir($main)) { if(!(($file==".")||($file==".."))) { $filename = file; } }
Will that only print the first one? as it looks familiar to one that i have that lists them all...
Yes - sorry. Remove the while loop or just add a break...
while($file = readdir($main)) { if(!(($file==".")||($file==".."))) { $filename = file; break; } }