Closed Bug 223980 Opened 21 years ago Closed 21 years ago

Content-Disposition: attachment; filename inexpected behavior from PHP (maybe others)

Categories

(Core :: Networking: HTTP, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 65827

People

(Reporter: rodrigoh, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 When running the following PHP (4.3.3) code: <? $file = "test.zip"; $fp = fopen($file,"rb") ; $download_size = filesize($file); header("Content-Type: application/zip"); header("Content-Disposition: attachment; filename=$file;"); header("Content-Transfer-Encoding: binary"); header("Accept-Ranges: bytes"); header("Content-Length: $download_size"); while (!feof($fp)) { $buff = fread($fp,4096); print $buff; } ?> on Apache (1.3) in a Windows 2000 server Service Pack 2, mozilla wrongfuly attaches the .php extension to the file, so in this case test.zip is offered to be saved as test.zip.php, the logged headers received from the server are the following ones: HTTP/1.1 200 OK Date: Tue, 28 Oct 2003 19:10:43 GMT Server: Apache/1.3.27 (Win32) PHP/4.3.3 X-Powered-By: PHP/4.3.3 Content-Disposition: attachment; filename=test.zip; Content-Transfer-Encoding: binary Accept-Ranges: bytes Content-Length: 2509 Content-Type: application/zip Connection: close Proxy-Connection: close The expected behavior can be seen in IE6.0, that is, offer to save the file as "test.zip", this can also be seen when saving Database scripts (.sql) with phpMySql, Mozilla will always append a .php (the extension of the server side script file) to the correct extension, other than that, the file is downloaded properly. Reproducible: Always Steps to Reproduce: 1. Enter the URL of the PHP script found on the summary provided that a test.zip file resides in the same directory as the script. 2. Notice how the Icon pressented and the file name shown has the .php extension appended to it. Actual Results: The file is saved with an incorrect extension, the user has to manually delete the offending extension. Expected Results: The file is saved with the correct extension, no further editing of the filename is required from the user.
wfm 20031027 Win2k (Apache 2.0.47 + PHP 4.3.3 on Win2k). I get a dialog with test.zip. moving to File Handling as per bug 65827 and bug 220832. Can you try again with latest trunk nightly build ?
Assignee: darin → file-handling
Component: Networking: HTTP → File Handling
*** This bug has been marked as a duplicate of 65827 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Component: File Handling → Networking: HTTP
Resolution: --- → DUPLICATE
this has been fixed after 1.5. 1.6alpha and later will contain the fix.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.