|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Force Download with the default filename of the actual file
Hi, currently i have a system set which forces people (on most browsers) to save the pdf document in question to disk. When this document saves the default save name is the name of the script rather then the name of the pdf document. Is there a way for me to make the default save name the actual name of the pdf document? here is my code...
@$fileName = "27xSdox/$filedata.pdf"; @$filesize = filesize($fileName); if($filesize) { @Header("Content-Length: ".$filesize); @Header("Content-Disposition: attachment; filename=".$fileName); @readfile($fileName); } thanks |
|
#2
|
|||
|
|||
|
RE: Force Download with the default filename of the actual file
is there something that you can place in the headers???try
http://www.php.net/header |
|
#3
|
|||
|
|||
|
RE: Force Download with the default filename of the actual file
This works for me:
// $file = only filename. // $filename = path and name. header("Content-type: download-application/unknown; name=$filename"); header("Content-Disposition: attachment; filename=$filename"); header("Content-Length: ".filesize($file)); If you are using Mac there is a bug in Microsoft IE which will cause downloads to get the script name. If this is the case please post a new message. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Force Download with the default filename of the actual file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|