Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Laravel:
- $tempImage = tempnam(sys_get_temp_dir(), $filename);
- copy('https://my-cdn.com/files/image.jpg', $tempImage);
- return response()->download($tempImage, $filename);
- // Core php:
- $archive_name = 'pathtoarchivearch1.tar';
- $dir_path = 'pathtodir';
- $archive = new PharData($archive_name);
- $archive->buildFromDirectory($dir_path); // make pathtoarchivearch1.tar
- $archive->compress(Phar::GZ); // make pathtoarchivearch1.tar.gz
- unlink($archive_name); // deleting pathtoarchivearch1.tar
Add Comment
Please, Sign In to add comment