: Displaying a list of files In my web application I have the user sign up for an account, then the account data is saved in a mysql database. The user can then go to "index.php" and log
In my web application I have the user sign up for an account, then the account data is saved in a mysql database. The user can then go to "index.php" and log in with their credentials. My application involves saving a file to a directory. So:
User logs in.
A table is displayed. The table contains a list of files saved in the directory that is for the individual user.
The user uploads a file to their directory (by directory I mean like a folder).
How could I display the files in a folder in a table () using php?
thanks!
More posts by @Ravi8258870
1 Comments
Sorted by latest first Latest Oldest Best
Use glob() to loop through the directory and get the list of files in it.
<?php
foreach (glob("*.*") as $filename) {
if (is_file($filename)) {
echo "$filename size " . filesize($filename) . "n";
}
}
?>
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.