Pogledajte određenu poruku
Staro 22. 09. 2006.   #1
Ilija Studen
Direktor Kombinata
Invented the damn thing
 
Avatar Ilija Studen
 
Datum učlanjenja: 07.06.2005
Poruke: 2.669
Hvala: 44
119 "Hvala" u 64 poruka
Ilija Studen će postati "faca" uskoroIlija Studen će postati "faca" uskoro
Default Download velikih fajlova se prekida na random mestu

Pozdrav,

Imam jedan misteriozan problem. Naime, čovek mi prijavljuje problem sa downloadom velikih fajlova - kada pokuša da downloaduje jedan fajl, nikada ga ne skine do kraja, izvršavanje se prekine na nekom random mestu. Naravno, fajl u tom obliku je neupotrebljiv.

Znam da je neko ovde pravio download manager pa da pitam da li je imao sličnih problema.

Citat:
I tried downloading 3 files on my Documents page from home tonight. The curious thing is that even though the 3 files varied in file size the download stopped on each one at 5.4MB. The actual number of bytes varied slightly.

This was after changing max_execution_time to 600, but the download stopped way before 10 minutes. It's got to be something else that causes it to stop.

I also asked someone else to download from their office and they only got 4.26MB downloaded before it stopped.
Funkcija kojom se proseđuje fajl klijentu:

PHP kôd:
/**
* Use content (from file, from database, other source...) and pass it to the browser as a file
*
* @param string $content
* @param string $type MIME type
* @param string $name File name
* @param integer $size File size
* @param boolean $force_download Send Content-Disposition: attachment to force save dialog
* @return boolean
*/
function download_contents($content$type$name$size$force_download false) {
  if(
connection_status() != 0) return false// check connection
  
  
if($force_download) {
    
header("Cache-Control: public");
  } else {
    
header("Cache-Control: no-store, no-cache, must-revalidate");
    
header("Cache-Control: post-check=0, pre-check=0"false);
    
header("Pragma: no-cache");
  } 
// if
  
header("Expires: " gmdate("D, d M Y H:i:s"mktime(date("H") + 2date("i"), date("s"), date("m"), date("d"), date("Y"))) . " GMT");
  
header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT");
  
header("Content-Type: $type");
  
header("Content-Length: " . (string) $size);
  
  
// Prepare disposition
  
$disposition $force_download 'attachment' 'inline';
  
header("Content-Disposition: $disposition; filename=\"" $name) . "\"";
  
header("Content-Transfer-Encoding: binary");
  print 
$content;
  
  return((
connection_status() == 0) && !connection_aborted());   
// download_contents 
Fun stuff

Btw, sadržaj se čuva u BLOB polju. Lično nisam imao nikakvih problema, mada nisam probao sa fajlovima većim od 10MB.
Ilija Studen je offline   Odgovorite uz citat