Forum Moderators: coopster

Message Too Old, No Replies

upload pic and txt files into mysql

         

akademik

4:03 pm on Oct 13, 2006 (gmt 0)

10+ Year Member



Hello, I want to enable user to upload pictures and text files on my server and store that files in mysql base. I know how to upload data from html forms, but this is something new for me. I have very little knowledge of PHP so please help.

In table should be cells for name, type and size. And how to limit size of file before uploading?

Also, maybe it is better to store pictures in some folder instead storing them in base and base keep only path to them. What is better?

I've looked over the web but couldn't find any tutorial for something like this. THANKS

mrnoisy

2:31 am on Oct 14, 2006 (gmt 0)

10+ Year Member



You should find everything you need here:

Chapter 38. Handling file uploads [php.net]

rokec

3:52 pm on Oct 17, 2006 (gmt 0)

10+ Year Member



the best is if you store images in a special folder, and mysql contain just path to them...

And once more...
You can't store files in mysql database!

coopster

8:41 pm on Oct 17, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Sure you can, but do you want to? Does it fit your application best to do so?
Storing Images in the Filesystem Versus a Database [webmasterworld.com]

And welcome to WebmasterWorld, akademik.

rokec

12:56 pm on Oct 18, 2006 (gmt 0)

10+ Year Member



You can upload files to mysql, but i (and many others) don't really recommend this. Large files in base could slow down queries... And if you are using a hosting: In most hosting the disk place is cheaper than mysql place (example I'm paying for a hosting where i have 10 GB disk space and only 70 MB of MySql space).

Sure, if you are using personal server that doesn't really matter.