02-16-2008, 08:02 PM
|
#4 (permalink)
|
|
The Frequenter
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
|
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
|
|
|