Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] błąd filesize()
-Gość-
post
Post #1





Goście







witam,
mam taka funkcje:
  1. <?php
  2. function DownloadFile($file,$nazwa) { // $file = include path
  3.  
  4.            header('Content-Description: File Transfer');
  5.            header('Content-Type: application/octet-stream');
  6.            header('Content-Disposition: attachment; filename='.$nazwa);
  7.            header('Content-Transfer-Encoding: binary');
  8.            header('Expires: 0');
  9.            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  10.            header('Pragma: public');
  11.            header('Content-Length: ' . filesize($file));
  12.            ob_clean();
  13.            flush();
  14.            readfile($file);
  15.    }
  16. ?>


lecz przy uzyciu czasami wywala mi blad:
Warning: filesize(): Stat failed for http://cycu1989.wrzuta.pl/aud/file2/7VZc5AbBIJ/ekwador_11 (errno=2 - No such file or directory) in /home/qqqqq/qqqqq/qqqqq/qqqqq/qqqqq/funkcje.php on line <b>11

czym to moze byc spowodowane ? jak to naprawic?

pzdr!
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
--chez--
post
Post #2





Goście







gdyz moj serwer ma ograniczone wiekszosc funkcji poradzilem sobie w inny sposob, zaraz dam rozwiazanie, dzieki Ci erix i hiszpanespaniol (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg) )

Cytat
function hHeader($urll){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $urll);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$r = curl_exec($ch);
return $r;
}
function DownloadFile($file,$nazwa) { // $file = include path

preg_match_all('|Location:(.*)Vary:|ismUu', hHeader($file), $wynik);
$wynik = trim($wynik[1][0]);
$header = hHeader($wynik);

preg_match_all('|Length:(.*)Last|ismUu', $header, $out);
$lLength = $out[1][0];
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 4.10.2025 - 19:06