chugmonkey Posted June 22, 2010 Share Posted June 22, 2010 Hi Folks, This is my first post here but I've been a reader for a long time. I've been given an interesting task in work which I have claimed can be easily done using PHP and MySQL. However, I'm not quite sure exactly how There are a little over 1.1m PDF files on my web server which are scanned invoices for my company. They all have an 8/9 digit serialised filename like 12345678.pdf and are stored in hierarchical, chronological folders. i.e. /root/scanned/2010/01/12345678.pdf They go back to 2004 at the moment. My goal is to be able to create a single link to any file using something along the lines of http://myserver/wizard.php?docid=12345678 Now, I have a working search which displays a page containing a link using sphider but the ideal would be me clicking the link above and a PDF being served to me, rather than a results page. I can't see any solutions like this anywhere and wondered if anyone has tried to do this before? ANY help or suggestions would be most appreciated. Best Regards, Pete Quote Link to comment https://forums.phpfreaks.com/topic/205521-search-style-url-redirecting-to-single-file/ Share on other sites More sharing options...
Alex Posted June 22, 2010 Share Posted June 22, 2010 You could create a simple script to loop through all the directories and store the location of each file in MySQL. Then finding the location of the correct pdf to serve to the user given the filename would only take a quick MySQL query. Quote Link to comment https://forums.phpfreaks.com/topic/205521-search-style-url-redirecting-to-single-file/#findComment-1075471 Share on other sites More sharing options...
chugmonkey Posted June 22, 2010 Author Share Posted June 22, 2010 Clearly I was tunnel visioned in thinking that this should/would be on-the-fly. Many thanks Alex, I'll get onto it straightaway! I greatly appreciate your prompt response Quote Link to comment https://forums.phpfreaks.com/topic/205521-search-style-url-redirecting-to-single-file/#findComment-1075474 Share on other sites More sharing options...
Alex Posted June 22, 2010 Share Posted June 22, 2010 Based on the sheer scale and number of files you're dealing with it really wouldn't be practical to this on the fly. Imagine searching aimlessly through 1.1 million files every time you needed to find something? That would be a mess Quote Link to comment https://forums.phpfreaks.com/topic/205521-search-style-url-redirecting-to-single-file/#findComment-1075475 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.