Xataface 2.0
Xataface Application Framework
blob.php
Go to the documentation of this file.
00001 <?php
00002 /*-------------------------------------------------------------------------------
00003  * Xataface Web Application Framework
00004  * Copyright (C) 2005-2008 Web Lite Solutions Corp (shannah@sfu.ca)
00005  * 
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  * 
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019  *-------------------------------------------------------------------------------
00020  */
00021 if ( !isset( $_REQUEST['-field'] ) ) die("Could not complete request.  No field name specified.");
00022 if ( !isset( $_REQUEST['-table'] ) ) die("Could not complete request.  No table specified.");
00023 
00024 require_once 'Dataface/Application.php';
00025 $app =& Dataface_Application::getInstance();
00026 $fieldname = $_REQUEST['-field'];
00027 $tablename = $_REQUEST['-table'];
00028 $table =& Dataface_Table::loadTable($tablename);
00029 
00030 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");
00031 $field =& $table->getField($fieldname);
00032 print_r($field); exit;
00033 if ( isset($_REQUEST['-index']) ) $index = $_REQUEST['-index'];
00034 else $index = 0;
00035 $queryTool =& Dataface_QueryTool::loadResult($tablename, null, $_REQUEST);
00036 $mimetype = $field['mimetype'];
00037 $columns = array($fieldname, $mimetype);
00038 $queryTool->loadCurrent($columns, true, true);
00039 //echo $mimetype;
00040 //echo $table->getValue($mimetype);
00041 header("Content-type: ".$table->getValue($mimetype, $index));
00042 //echo "Here";
00043 echo $table->getValue($fieldname, $index);
00044 
00045 
00046 //$res = mysql_query("select small_image from unit_plans limit 1", $app->_db);
00047 //list($val2) = mysql_fetch_row($res);
00048 //echo "Len 1: ".strlen($val);
00049 //echo "Len 2: ".strlen($val2);
00050 //if ( $val === $val2 ) echo "They are the same";
00051 
 All Data Structures Namespaces Files Functions Variables Enumerations