php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78520 php download file name ≈你 好;123.zip
Submitted: 2019-09-10 03:14 UTC Modified: 2019-09-10 05:40 UTC
From: 77738609 at qq dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.4.0RC1 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: 77738609 at qq dot com
New email:
PHP Version: OS:

 

 [2019-09-10 03:14 UTC] 77738609 at qq dot com
Description:
------------
php download file name '≈你 好;123.zip'; file name is &ap

c# can download 

Test script:
---------------
php download file name '≈你 好;123.zip';
$filename = iconv('utf-8',"gbk//IGNORE",$filename);

$filepath = 'D:/www/'.$filename;


$file=fopen($filepath,"r");

header("Content-type:text/html;charset=utf-8");

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

header("Accept-Ranges: bytes");

header("Accept-Length: ".filesize($filepath));

header("Content-Disposition: attachment; filename= $filename ; filename*=utf-8''$filename ");

echo fread($file,filesize($filepath));

fclose($file);

Expected result:
----------------
php download file name '≈你 好;123.zip';

Actual result:
--------------
php download file name '≈你 好;123.zip';

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-09-10 03:26 UTC] 77738609 at qq dot com
Actual result:&ap 

Expected result: '≈你 好;123.zip';
 [2019-09-10 05:40 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Package: *URL Functions +Package: *General Issues
 [2019-09-10 05:40 UTC] requinix@php.net
If $filename has semicolons then it needs to be quoted in the Content-Disposition, and it's using the wrong encoding.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 09:01:32 2025 UTC