View Single Post
ישן 07-10-12, 02:33   # 1
איציק ברבי
עסק רשום [?]
 
מיני פרופיל
תאריך הצטרפות: Feb 2011
הודעות: 970

איציק ברבי לא מחובר  

הורדה משרת רחוק, תוך כדי הפנייה אל השרת שלי.

יש לי קישור הורדה מאתר אחר לדוגמא(http://google.co.il/500mb.rar)

אני מעוניין לעשות סוג של העברה,
גולש מסויים יכנס לכתובת אתר שלי.
xxx.xxx.xxx.xxx/file.php
אני רוצה שיקפוץ לו חלון הורדה של הקובץ שהבאתי למעלה,(500mb.rar)
אז שיועבר דרכי,
אז עשיתי ככה:

PHP קוד:
header('Content-Description: File Transfer');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header("Content-Type: ".$url);
header("Content-Disposition: attachment; filename=".$url);  
header('Content-Length: ' size($r));
ob_clean();
flush();
readfile($n); 
**
function size()
PHP קוד:
$file $n;
$ch curl_init($file);
curl_setopt($chCURLOPT_NOBODYtrue);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HEADERtrue);
curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
$data curl_exec($ch);
curl_close($ch);
if(
preg_match('/Content-Length: (\d+)/'$data$matches)) {
    
$contentLength = (int)$matches[1];
}
return 
$contentLength
הוא מוריד הכל טוב ויפה,
אבל הוא לא מראה כמה גודל הקובץ, כמה נותר וכ'ו(בדפדפן)..
__________________

איציק ברבי - שירות לקוחות
כתובת אתר: http://build-net.co.il/
איימל: Support@build-net.co.il
טלפון: 052-3937296.

Last edited by איציק ברבי; 07-10-12 at 03:02..
  Reply With Quote