Uploading an image to mysql, for a shopping cart application, I've got a form that posts to this (and more, of course):
$set = "SET name='".$name."', description='".$description."', stock_no='".$stock_no."', summary='".$summary."'";
If ($photo != "none") {
$data = addslashes(fread(fopen($photo, "r"), filesize($photo)));
$set .= ", photo_binary='".$data."', photo_type='".$photo_type."'";
}
If ($item_id > "") {
$sql = "UPDATE items ".$set." WHERE item_id='".$item_id."'";
} Else {
$sql = "INSERT INTO items ".$set.", sub_cat_id='".$sub_cat_id."'";
}
When I echo $sql, I get:
UPDATE items SET name='blah', description=' blah', stock_no='blah', summary='blah', photo_binary='Content-Type: image/pjpeg ÿØÿà\0JFIF...etc. and my HTTP_POST_FILES["photo"] type is empty. On another server where I've got this script working, photo type is not empty, and photo_binary='ÿØÿà\0JFIF...etc. (and it works fine)
So why does one server successfully pull the image type off the front of the image and store it in the $HTTP_POST_FILES["photo"] array and the other server does not? Ideas, anyone?
thanks, as always