With DB, you can give files faux names and locations. You could just name files: fileX.ext where the 'ext' is the true extension of the file and X can relate to the file's id within the db. This means that you can save all files within the same folder without any danger of overwriting etc.
So:
files table
id (Primary Key etc)
filename (actual physical name on server)
author (Foreign Key??)
ext (e.g. jpg, gif, pdf etc)
faux_file (false name or alias)
faux_folder (false path)
status (hidden, protected etc)
size
title
description
date_created
date_last_modified
(etc)
when file uploaded:
enter all file details to DB except physical filename
get ID via mysql_insert_id()
enter DB physical filename and rename physical file to fileX.ext
[X = id, ext = from db]
This is off top of my head, bet it could be made smoother with a bit of thinking.
You can search effectively as opposed to iterating over disparate folders - yuk. It also offers functionality w.r.t protecting document location.
diafol
Keep Smiling
10,838 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,534
Skill Endorsements: 61
Question Answered as of 3 Years Ago by
vaultdweller123,
diafol
and
parkeyparker