Jump to content

Search Style URL Redirecting to Single File


chugmonkey

Recommended Posts

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  ;D

 

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :P

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.