PHP Upload...with MySQL?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bumple
Forum Commoner
Posts: 34
Joined: Thu Jan 08, 2004 4:38 am

PHP Upload...with MySQL?

Post by bumple »

Hi all,

I have a website for friends of mine to come, register, log in, and access a few members pages (all working very well). However, my latest project for the members section is to add a upload documents page for my friends to upload Word documents (.doc) to my website. Since there will be many members at my site, I was wondering...is there a possibility to store the .doc files in my MySQL database? Or should I save all the documents in a folder on my server with the username as the document name? Thanks a lot!
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

You can do either, although its probably easier to just upload the files and store them in a dir. I added a file upload class to the code snipet forum on this site which will do everything you want - so you can use that, or copy from it.

But either way you will still have to upload the .doc file as when adding it to a database you will need the file to read from, so the user either has to serve it to the server, or upload it to the server.
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

i think you should store them in a directory, but i have one tip:
do not use their usernames as filenames, use their ID or something, becuase usernames could contain characters not allowed in an filename, have strange caps, spaces, etc..
Post Reply