Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //könyvtár public ("frontend") mappával párhuzamos ("upload") mappa elérési útja
- $upload = str_replace("frontend", "", $_SERVER['DOCUMENT_ROOT']) . "upload/";
- //kép fájl megnyitás adatbázisban tárolt elemek alapján
- include_once 'dbconnect.php';
- $iid = $_GET['iid'];
- $sql=new ownedsql;
- $sql->connect();
- $sql->query("SELECT iPath, iFile FROM 3i_rest_images WHERE iid='$iid' AND iActive='1'");
- $result = $sql->query;
- $sql->kill();
- $result = mysql_fetch_array($result);
- $fullPath = $result['iPath'] . $result['iFile'];
- if ($fd = fopen($fullPath, "r")) {
- $fsize = filesize($fullPath);
- $path_parts = pathinfo($fullPath);
- $ext = strtolower($path_parts["extension"]);
- switch ($ext) {
- case "jpg":
- header("Content-type: image/jpeg");
- header("Content-Disposition: filename=\"" . $path_parts["basename"] . "\"");
- break;
- default;
- header("Content-type: application/octet-stream");
- header("Content-Disposition: filename=\"" . $path_parts["basename"] . "\"");
- }
- header("Content-length: $fsize");
- header("Cache-control: private");
- while (!feof($fd)) {
- $buffer = fread($fd, 2048);
- echo $buffer;
- }
- }
- fclose($fd);
- exit;
- ?>
Add Comment
Please, Sign In to add comment