Dosya gönderme fonksiyonu

Nursen

Paylaşımcı Üye
Katılım
24 Nis 2020
Mesajlar
1,046
Beğeniler
5
İstediğiniz dosyayı 8K 'lık sınırla gönderebilirsiniz.

Kod:
function send_file($name) { 
 $status = FALSE; 
 $path = $name; 
 if (!is_file($path) or connection_status()!=0) return(FALSE); 
 header("Content-type: application/octet-stream"); 
 header("Content-Disposition: inline; filename=\"".$name."\""); 
 header("Content-length: ".(string)(filesize($path))); 
 header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")+2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT"); 
 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); 
 header("Cache-Control: no-cache, must-revalidate"); 
 header("Pragma: no-cache"); 
 if ($file = fopen($path, 'rb')) { 
   while(!feof($file) and (connection_status()==0)) { 
     print(fread($file, 1024*8)); 
      flush(); 
   } 
   $status = (connection_status()==0); 
   fclose($file); 
 } 
 return($status); 
}
 

Şu anda bu konu'yu okuyan kullanıcılar

Benzer konular

Üst