Problem with blob field
Archived from the Xataface Users forum.
fantomasdm — Mon May 31, 2010 5:37 am
Hi, I have a table with this fields:
- Code: Select all
CREATE TABLE `files` ( `idfiles` bigint(20) NOT NULL AUTO_INCREMENT, `datacreazione` date DEFAULT NULL, `utentecreazione` int(11) DEFAULT NULL, `datamodifica` date DEFAULT NULL, `utentemodifica` int(11) DEFAULT NULL, `file_mimetype` varchar(64) COLLATE latin1_general_ci DEFAULT 'jpeg', `file_filename` varchar(64) COLLATE latin1_general_ci DEFAULT NULL, `note` mediumtext COLLATE latin1_general_ci, `file` longblob, PRIMARY KEY (`idfiles`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
and fields.ini:
- Code: Select all
- `[file]
Type = blob
widget:type = file[note]
widget:type = htmlarea[utentecreazione]
widget:type = select
vocabulary = utenti[utentemodifica]
widget:type = select
vocabulary = utenti`
when I try to download a file, the link name is:
“files_file_2010_05_31_12_46_14”
without any file extension!!
fantomasdm — Mon May 31, 2010 5:52 am
Sorry, I have forgotten some specification:
xataface :1.2.4 on wamp windows Seven Pro.
P.S. I think that the problems is on line 220 of blob.php, $record->getValue($field[‘filename’], $index) return null, but $field[‘filename’] is correct
(file_filename in my case)!!
I try to put some debug code, but $record->getValue(‘file_filename’, $index) return null.
fantomasdm — Tue Jun 01, 2010 1:07 am
HI!, I find the problem!!
When load record with blob using { $record =& $queryTool->loadCurrent($columns, true, true); } only bolb fields is loading!!!
then I call loadCurrent two time!! this my code in blob.php at line 192…circa
- Code: Select all
$record =& $queryTool->loadCurrent($columns, true, true); $record->loadBlobs = true; $contents = $record->getValue($fieldname, $index); $found = $cachePath.'-'.time(); if ( $fh = fopen($found, "w") ){ fwrite($fh, $contents); fclose($fh); } else { $found = false; } } $record =& $queryTool->loadCurrent($columns, true);
I add {$record =& $queryTool->loadCurrent($columns, true)} after load contents blob, and now all works!