Guest User

Untitled

a guest
Apr 24th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. // Laravel:
  2. $tempImage = tempnam(sys_get_temp_dir(), $filename);
  3. copy('https://my-cdn.com/files/image.jpg', $tempImage);
  4. return response()->download($tempImage, $filename);
  5.  
  6. // Core php:
  7. $archive_name = 'pathtoarchivearch1.tar';
  8. $dir_path = 'pathtodir';
  9.  
  10. $archive = new PharData($archive_name);
  11. $archive->buildFromDirectory($dir_path); // make pathtoarchivearch1.tar
  12. $archive->compress(Phar::GZ); // make pathtoarchivearch1.tar.gz
  13. unlink($archive_name); // deleting pathtoarchivearch1.tar
Add Comment
Please, Sign In to add comment