DataObject insert problem
| From: | Ryan King | Date: | Mon, 08 Mar 2004 20:50:46 +0000 |
| Subject: | DataObject insert problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11165@lists.php.net to get a copy of this message | ||
$media = DB_DataObject::factory('media');
$media->setId($id);
$media->setShort_description($short_description);
$media->setLong_description($long_description);
if (is_file($_FILES['media']['tmp_name'])) {
$media->setType($_FILES['media']['type']);
$media->setFile_name($_FILES['media']['name']);
$file_path = $_FILES['media']['tmp_name'];
$data = file_get_contents($file_path) or die( "Can't open file!" );
$media->setData(base64_encode($data));
}
When I then call $media->insert(), the sql that is produced does not include the 'data'
field. When I dump the $media object, the encoded file is in the object, but for some reason does
not get included in the sql insert statement.
I've poked around in the DataObject source, but have not been able to figure out what's
going on.
-Ryan
---------
http://homepage.mac.com/ryansking/