Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
blob.php
Go to the documentation of this file.
1 <?php
2 /*-------------------------------------------------------------------------------
3  * Xataface Web Application Framework
4  * Copyright (C) 2005-2008 Web Lite Solutions Corp (shannah@sfu.ca)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *-------------------------------------------------------------------------------
20  */
21 if ( !isset( $_REQUEST['-field'] ) ) die("Could not complete request. No field name specified.");
22 if ( !isset( $_REQUEST['-table'] ) ) die("Could not complete request. No table specified.");
23 
24 require_once 'Dataface/Application.php';
26 $fieldname = $_REQUEST['-field'];
27 $tablename = $_REQUEST['-table'];
29 
30 if ( !$table->isBlob($fieldname) ) die("blob.php can only be used to load BLOB or Binary columns. The requested field '$fieldname' is not a blob");
31 $field =& $table->getField($fieldname);
32 print_r($field); exit;
33 if ( isset($_REQUEST['-index']) ) $index = $_REQUEST['-index'];
34 else $index = 0;
36 $mimetype = $field['mimetype'];
38 $queryTool->loadCurrent($columns, true, true);
39 //echo $mimetype;
40 //echo $table->getValue($mimetype);
41 header("Content-type: ".$table->getValue($mimetype, $index));
42 //echo "Here";
43 echo $table->getValue($fieldname, $index);
44 
45 
46 //$res = mysql_query("select small_image from unit_plans limit 1", $app->_db);
47 //list($val2) = mysql_fetch_row($res);
48 //echo "Len 1: ".strlen($val);
49 //echo "Len 2: ".strlen($val2);
50 //if ( $val === $val2 ) echo "They are the same";
51