Make PHP show folder files

Asked

Viewed 117 times

0

Guys, I’m working on my project. A reading app.

But I want to do one thing to help in it, I have over 12000 pdf’s to put in the app.

I wanted to put the pdf in the folder it appeared as shown in the photo below

Or the method used there is a post? help me

Obs kind of Exemplo de como eu quero

  • 1

    You can do it by listing the files in the directory, yes! The point is that this is by no means the best way to do this. A good way would be to rename all Pdfs by putting in them simple names, without spaces, accents, special characters and preface, random names to avoid collision, Example: 31af03ba111d8c38a3be9936c9c427ba.pdf and there you would use a database to register the entire collection, linking the name of the file with the registered title in the bank. That’s a good way. The point is, you’re willing to go to all this trouble to have a better system?

  • 2
  • And how could I do that? :D don’t know much kk

1 answer

0

Follow an example to list the files (of a certain type) in a directory.

chdir( 'path' );
$files = glob("{*.pdf,}", GLOB_BRACE);
foreach($files as $file) echo $file;

Remembering that as commented, this is not the best way for a solution like yours. ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.