| | |
Can PHP search a folder for a file?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I have a website that lists pdf files for downloading, with links to each file.
What I want to do now is design a search page that will look in the folder that contains these docs and search for docs that match a partial name.
I have created search pages for MySQL before - do I have to create a table with file names and links and then do a search of MySQL?
TIA,
jej1216
What I want to do now is design a search page that will look in the folder that contains these docs and search for docs that match a partial name.
I have created search pages for MySQL before - do I have to create a table with file names and links and then do a search of MySQL?
TIA,
jej1216
It is possible, however it is said that such functions are subject to vulnerability.
Still - I have made such thing and it is quite self-maintaining page you will get out of it.
See the PHP manual for functions readdir and scandir. It is quite simple to do it.
Still - I have made such thing and it is quite self-maintaining page you will get out of it.
See the PHP manual for functions readdir and scandir. It is quite simple to do it.
" Of all the things I've lost,
I miss my mind the most...."
Mark Twain
I miss my mind the most...."
Mark Twain
•
•
•
•
I have a website that lists pdf files for downloading, with links to each file.
What I want to do now is design a search page that will look in the folder that contains these docs and search for docs that match a partial name.
I have created search pages for MySQL before - do I have to create a table with file names and links and then do a search of MySQL?
TIA,
jej1216
You'd get better performance by indexing the files in a db like you said, since searching database rows is much faster than scanning a directory, especially if you have many files.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Thanks for all of the quick replies!
I'll try the opendir and scandir and see if that is quick enough for our purposes. If it's too slow, I'll do the database approach.
Rhyan - you said "It is possible, however it is said that such functions are subject to vulnerability." What vulnerablility? Hacking?
Thanks everyone.
jej1216
I'll try the opendir and scandir and see if that is quick enough for our purposes. If it's too slow, I'll do the database approach.
Rhyan - you said "It is possible, however it is said that such functions are subject to vulnerability." What vulnerablility? Hacking?
Thanks everyone.
jej1216
![]() |
Similar Threads
- creating an advanced php search (PHP)
- Search string in a text file (C)
- New User (C)
- PHP File Searching (PHP)
Other Threads in the PHP Forum
- Previous Thread: Software Developer Needed - Midi file converter to .lmz
- Next Thread: Php-smarty
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess 301 access ajax apache api array beginner binary broken cakephp checkbox class cms code compression cron curl database date directory display download dropdown dynamic echo email error file files folder form forms function functions google href htaccess html httppost image include insert integration ip java javascript joomla limit link login loop mail md5 menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search secure select server sessions sms soap source space speed sql structure syntax system table tutorial update upload url validation validator variable video votedown web xml youtube






