Biggest advantage of this approach is, you are not required to maintain a seperate directory for documents or images and this proves to be really handy in case you move directories or change servers. You need not worry about the links from the database. Also you need not worry about any complex version control systems to store documents with a same name.

1. Create a table

1. id – INT (6)
2. filename – VARCHAR (100)
3. filetype – VARCHAR (50)
4. filesize – VARCHAR (20)
5. file – BLOB or MEDIUM BLOB

2. File upload (uploadfile.php)

3. Process the above form (procesform.php)

4. Get file (get-file.php)

5. Download a file

Now to download a file just link the file to get-file.php with an id


Leave a Reply

Your email address will not be published. Required fields are marked *