[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Users/ -> downloadfile.php (source)

   1  <?php
   2  /********************************************************************************
   3  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9  * 
  10   ********************************************************************************/
  11  
  12  require_once ('config.php');
  13  require_once ('include/database/PearDatabase.php');
  14  
  15  global $fileId;
  16  
  17  $templateid = $_REQUEST['record'];
  18  $dbQuery = "SELECT filename,filetype, data ";
  19  $dbQuery .= "FROM vtiger_wordtemplates ";
  20  $dbQuery .= "WHERE templateid=" .$templateid;
  21  
  22  $result = $adb->query($dbQuery) or die("Couldn't get file list");
  23  if($adb->num_rows($result) == 1)
  24  {
  25  $fileType = $adb->query_result($result, 0, "filetype");
  26  $name = $adb->query_result($result, 0, "filename");
  27  //echo 'filetype is ' .$fileType;
  28  $fileContent = $adb->query_result($result, 0, "data");
  29  $size = $adb->query_result($result, 0, "filesize");
  30  header("Content-type: $fileType");
  31  //header("Content-length: $size");
  32  header("Cache-Control: private");
  33  header("Content-Disposition: attachment; filename=$name");
  34  header("Content-Description: PHP Generated Data");
  35  echo base64_decode($fileContent);
  36  }
  37  else
  38  {
  39  echo "Record doesn't exist.";
  40  }
  41  ?>
  42  


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7