Advertisement
hakancix

Untitled

Nov 26th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2. ob_start();
  3. include ("../../con/conf.php");
  4.  
  5. ?>
  6.  
  7. <?php
  8. /*Postala Gelen Fotoğraf Değerleri Ardından Zipleme İşlemi*/
  9.     if ($_POST){
  10.         if (extension_loaded("zip")){
  11.             if (count($_POST["dosya"]) > 0){
  12.                 $zip = new ZipArchive();
  13.                 $zipAdi = time().".zip";
  14.                 if ($zip->open($zipAdi, ZIPARCHIVE::CREATE)){
  15.                    
  16.                     foreach ($_POST["dosya"] as $dosya){
  17.                        
  18.                         $zip->addFile($dosya);
  19.                        
  20.                        
  21.                     }
  22.                    
  23.                     $zip->close();
  24.                    
  25.                     if (file_exists($zipAdi)){
  26.                         header("Content-type: application/zip");
  27.                         header("Content-disposition: attachment; filename={$zipAdi}");
  28.                         readfile($zipAdi);
  29.                         unlink($zipAdi);
  30.                     }else {
  31.                         echo "ZIP Dosyası Bulunamadı!";
  32.                     }
  33.                    
  34.                 }else {
  35.                     echo "ZIP Dosyası oluşturulamadı.";
  36.                 }
  37.             }else {
  38.                 echo "Birşeyler Seçin.";
  39.             }
  40.         }else {
  41.             echo "ZIP Extension Yüklü Değil.";
  42.         }
  43.     }
  44.  
  45. ?>
  46.  
  47. </body>
  48. </html>
  49. <?php
  50. ob_end_flush();
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement