View Single Post
Old 02-16-2008, 08:02 PM   #4 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

Your form would look something like:

Code:
<form enctype="multipart/form-data" action="upload.php" method="post">
	<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
	<input name="image[]" type="file" />
	<input type="submit" value="Submit" />
</form>
The important bit being the 'enctype'.

Then in your upload script, you would have something like the following to insert the image to your database:

PHP Code:
$image file_get_contents($_FILES['image']['tmp_name']);
mysql_query("INSERT INTO images (image_data) VALUES ('" $image "')"); 
You'd want to put a few checks in their and use escape_string(), but that's the basics of it.

Alan
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote