Kadir Özdemir

  • Ben Kimim
  • PHP
  • Sencha Touch
  • Home/
  • PHP /
  • php ile zip download

php ile zip download

Skorp 24.09.2010 Leave a Comment

bugünki yazimizda php ile bircok dosyayi bir zip arsiv i ile nasil indiririz ona bakacagiz.


$file_names = array("dosya1.pdf","dosya2.pdf","dosya3.pdf");
$archive_file_name = "download.zip";
//zip objesi olustur
$zip = new ZipArchive();
//  dosyayi olustur
  if ($zip->open($archive_file_name, ZIPARCHIVE::CREATE )!==TRUE) {
    exit("cannot open < $archive_file_name>\n");
  }
  //zip e eklenecek olan dosyalari ekle
  foreach($file_names as $files)
  {
   //$file_path.$files filepath dosya yolu, files ise dosya adi,
	//ikinci $files parametresi zip deki dosya adi
    $zip->addFile($file_path.$files,$files);
  }
  $zip->close();
  //header ile download islemini baslattir
  header("Content-type: application/zip");
  header("Content-Disposition: attachment; filename=$archive_file_name");
  header("Pragma: no-cache");
  header("Expires: 0");
  readfile("$archive_file_name");
  exit;

ziparchive php 5.2 ye den sonra eklenmistir, bundan kücük sürüm kullananlar pecl extension u kurmalari gerekiyor.

Skorp
2010-09-24
Tags:
PHP
Share story:
← PreviousJquery Validation sonradan kural ekleme
Next →CentOS de XenServer Tools kurulumu

Written by Skorp

View all articles by Skorp

Website: http://www.skorp.eu

Related Articles

  • Silverstripe snippetler

  • Silverstripe login sorunu

  • Silverstripe: Sorgulari Cachleme

  • Php 5.4 yayinlandi

  • Silverstripe yeni sayfa tipleri

Leave a Comment Cancel Reply

Your email address will not be published. Required fields are marked *

Social networks

Etiket Bulutu

Android Bilgisayar & Internet C# Cms css diger Kodlar featured Genel Java Javascript Linux Mobile PHP Silverstripe typo3 Veritabani Windows Zend Framework

Links

  • H E R K O N U
  • Hüseyin Koyun
  • Urban23k

Son Yorumlar

  • Primary Key – Unique ve Index nedir? için Onur
  • Centos de apache, php ve mysql kurulumu için sezer fidancı
  • React Native – Kurulum için React Native | Kadir Özdemir
  • React Native için React Native – Kurulum | Kadir Özdemir
  • Ben Kimim için serkan

Twitter

Follow @skorp54
There is an error in twitter widget, please make sure that you have set up the Twitter API settings
  • Ben Kimim
  • PHP
  • Sencha Touch

Arsivler

Kategoriler

Copyright © 2014 webberz.at