-1

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:

  1. User logs in.
  2. A table is displayed. The table contains a list of files saved in the directory that is for the individual user.
  3. 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!

0

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.