View Single Post
ישן 06-09-08, 20:51   # 16
dabi
חבר וותיק
 
מיני פרופיל
תאריך הצטרפות: Dec 2007
הודעות: 1,767

dabi לא מחובר  

ניסיתי להשתמש בפנקציה
file_get_contents
PHP קוד:
<?php
ob_start
();

$filename='1.gif';

// fix for IE catching or PHP bug issue
header("Pragma: public");
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// browser must download file from server instead of cache

// force download dialog
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");

// use the Content-Disposition header to supply a recommended filename and
// force the browser to display the save dialog.
header("Content-Disposition: attachment; filename=".basename($filename).";");

/*
The Content-transfer-encoding header should be binary, since the file will be read
directly from the disk and the raw bytes passed to the downloading computer.
The Content-length header is useful to set for downloads. The browser will be able to
show a progress meter as a file downloads. The content-lenght can be determines by
filesize function returns the size of a file.
*/
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));

@
file_get_contents($filename);  
exit(
0);

?>
שימו לב בשורה לפני האחרונה רשמתי
PHP קוד:
@file_get_contents($filename); 
במקום
PHP קוד:
@readfile($filename); 
וזה עדיין הוריד לי את הקובץ אבל קובץ ששוקל 0 קילו בייט ולא מכיל תמונה אלא סתם קובץ בשם 1.gif

Last edited by dabi; 06-09-08 at 20:58..
  Reply With Quote