04-29-2008, 11:18 PM
|
#3 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
I don't have a tutorial for uploading, but I can address your more specific questions.
Quote:
Originally Posted by delayedinsanity
I'm guessing to store an image in a MySQL database you would probably use something like base64_encode() or a blob data field. I'm thinking though that it's probably a hell of a lot faster to store files physically on the server and just store their location in the database. Less data in the database makes it quicker to access, and not having to encode or decode an image on retrieval would also add to the speed factor. Any opinions? When would storing an image in the database be recommendable?
-m
|
Don't store files in the database, there is a reason it is called a database and your file server is called a file server. If you need to keep track of things, keep their location in the database.
Quote:
Originally Posted by delayedinsanity
On that note, while I'm playing around with a basic form and the $_FILES superglobal to get comfortable with it, I was curious -- is there any way to check a file for any information before it's uploaded? For example, to make sure if I want a 30kb or less file, they aren't trying to upload a 2mb file? I know how to check this once the file is uploaded, and it's easy to throw em back an error, but it seems like a waste to let somebody upload a large file only to be caught with "um, you're dumb, go back and read the instructions.". I won't word it like that on my production server, just the test one, but you get the idea.
-m
|
Yes, $HTTP_POST_FILES['userfile']['size']
|
|
|
|