Mobile app version of vmapp.org
Login or Join
Ravi8258870

: 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

@Ravi8258870

Posted in: #Database #Directory #Mysql #Php

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!

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Ravi8258870

1 Comments

Sorted by latest first Latest Oldest Best

 

@Pope3001725

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";
}
}
?>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme