����JFIF��x�x����'
Server IP : 78.140.185.180 / Your IP : 3.17.141.193 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/public_html/app/Http/Controllers/ |
Upload File : |
<?php namespace App\Http\Controllers; use App\Project; use App\Services\ProjectRepository; use Carbon\Carbon; use Common\Core\BaseController; use Storage; use ZipStream\Option\Archive; use ZipStream\ZipStream; class ProjectDownloadController extends BaseController { /** * @var ProjectRepository */ private $projectRepository; public function __construct(ProjectRepository $projectRepository) { $this->projectRepository = $projectRepository; } public function download(Project $project) { $projectPath = $this->projectRepository->getProjectPath($project); $disk = Storage::disk('projects'); $this->authorize('download', $project); $options = new Archive(); $options->setSendHttpHeaders(true); $timestamp = Carbon::now()->getTimestamp(); $zip = new ZipStream("download-$timestamp.zip", $options); $paths = $disk->allFiles($projectPath); foreach ($paths as $relativePath) { $zip->addFileFromPath( str_replace($projectPath, '', $relativePath), $disk->path($relativePath), ); } $zip->finish(); } }