示例#1
0
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is: CalemEAM Open Source
 *
 * The Initial Developer of the Original Code is CalemEAM Inc.
 * Portions created by CalemEAM are Copyright (C) 2007 CalemEAM Inc.;
 * All Rights Reserved.
 * Contributor(s): 
 */
//Checking basic initialization
if (!defined('_CALEM_DIR_')) {
    die("Access denied at " . __FILE__);
}
require_once _CALEM_DIR_ . 'server/include/core/CalemFactory.php';
require_once _CALEM_DIR_ . 'server/include/util/CalemGzip.php';
//Provide data or settings in this case
$fid = $_REQUEST['fid'];
$dbo = CalemFactory::getDbo('doc_upload');
try {
    $row = $dbo->fetchById($fid);
    $path = $_CALEM_conf['upload_conf']['dir_map'][$row['access_id']];
    $fp = _CALEM_DIR_ . $path . $row['file_upload'];
    CalemGzip::downloadFile($fp, $_CALEM_conf['upload_conf']['gzip']);
} catch (CalemDboDataNotFoundException $dnf) {
    print 'Upload data not found in the database';
    return;
}