• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

assessment/displaytempimage.php

Go to the documentation of this file.
00001 <?php
00002         if (!$_GET["gfx"]) exit();
00003         chdir("..");
00004         require_once "./include/inc.header.php";
00005         include_once "./classes/class.ilUtil.php";
00006         // calculate directory of temporary file
00007         $dirname = dirname(ilUtil::ilTempnam());
00008         // remove special path symbols from the file name to prevent security hacks
00009         $image = str_replace("..", "", $_GET["gfx"]);
00010         $image = str_replace("/", "", $image);
00011         $image = str_replace("%", "", $image);
00012         $image = str_replace("\\", "", $image);
00013         $image = $dirname . "/" . $image;
00014         $size = getimagesize($image);
00015         // only proceed if the file is an image
00016         if (is_array($size) && (strpos($size["mime"], "image") !== FALSE))
00017         {
00018                 header("Content-Type: " . $size["mime"]);
00019                 header('Content-Length: '.filesize($image));
00020                 readfile($image);
00021                 if (is_file($image))
00022                 {
00023                         // it's a temporary file, delete it after it was shown to save disk space
00024                         unlink ($image);
00025                 }
00026         }
00027 ?>

Generated on Fri Dec 13 2013 09:06:33 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1