Hi All,

Im trying to find a method to allow files to be:

1. Uploaded and stored in a mysql database
2. List them, with "change" and "delete" options
3. Allow them to be downloaded, or even just viewed

I have tried using blobs, but to no avail. I have used a great number of scripts, all of which havent worked at all. i have posted other threads about these errors but to no avail.

Can anybody help me sort this out? Even if its not really using a blob, but a URL instead that would be a great help.

8 Years
Discussion Span
Last Post by diafol

You definitely want to store urls, NOT the file itself.

See the php manual for file uploading ( http://uk2.php.net/manual/en/function.move-uploaded-file.php ). To that tag on a mysql function that writes the path/filename and other file-related data to your table.

File uploading is notoriously problematic if you've never done it before. File locations are typically accessed from the virtual root. If you place $_SERVER . "/myuploads/" for example as your destination, you should be fine (if "/myuploads/" is a top-level folder under htdocs or public_html). However, if you can reference the upload folder by a relative reference, you could try that. In addition, your urls in the mysql table SHOULD NOT include this virtual root info, they should be written with an absolute reference: "/myuploads/...."

I'm sure other users have different ideas, but there's my input for what it's worth.


Ok thats brilliant.

Now im thinking that files can be uploaded using the usual "browse" and upload to a folder. Are you able to give a code example as to how i could get php to pick up all files in a specific directory and then display to screen as clickable/downloadable url?

Thanks for your input


Yes - form upload button - quite straightforward. Check out the php manual on uploads and Google "php uploads". Should be millions of 'em. Search this forum too.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.