Create fetchTemp.php

This commit is contained in:
Mattia Mascarello 2022-08-26 04:34:19 +02:00 committed by GitHub
parent 0398569f7c
commit 008cb1a9bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

11
src/fetchTemp.php Normal file
View File

@ -0,0 +1,11 @@
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$file = 'temp/'.preg_replace("/[^A-Za-z0-9 ]/", '', $_GET["id"]).'.jpg';
$type = 'image/jpeg';
header('Content-Type:'.$type);
header('Content-Length: ' . filesize($file));
readfile($file);
unlink($file);
unlink('temp/'.$_GET["id"].'.jpg');