Re: DataObject insert problem
| From: | Ryan King | Date: | Wed, 10 Mar 2004 14:43:53 +0000 |
| Subject: | Re: DataObject insert problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11202@lists.php.net to get a copy of this message | ||
Sorry for the slowness..
Here's my media section:
[media]
id = 129
data = 257
created_datetime = 14
short_description = 2
type = 130
file_name = 2
long_description = 2
Thanks,
Ryan
On Monday, March 08, 2004, at 04:52PM, Norbert Mocsnik <pear-general@mocsnik.hu> wrote:
>Hello,
>
>Could you send the [media] section from your databasename.ini to the list?
>
>Regards,
>Norbert
>
>Ryan King wrote:
>
>> $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/
>>
>
>--
>PEAR General Mailing List (http://pear.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
---------
http://homepage.mac.com/ryansking/