|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-03-03 07:05 UTC] hradtke@php.net
[2012-06-16 13:54 UTC] langemeijer@php.net
-Status: Wont fix
+Status: Re-Opened
[2012-06-16 13:54 UTC] langemeijer@php.net
[2022-08-05 21:11 UTC] bukka@php.net
-Package: Streams related
+Package: FTP related
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 03:00:01 2025 UTC |
Description: ------------ It seems that the FTP fopen wrapper truncates file names when it encounters a pound sign (#). The FTP server's log shows a request for "file". I have tried replacing the # with %23 (the result of urlencode), but the server sees that as a request for "file%231.txt". Reproduce code: --------------- // Use fopen wrapper $data = file_get_contents("ftp://username:password@ftp.example.com/file #1.txt"); var_dump(strlen($data)); // Use ftp_* functions $conn = ftp_connect('ftp.example.com'); ftp_login($conn, 'username', 'password'); ftp_get($conn, 'C:\\test.txt', 'file#1.txt', FTP_BINARY); var_dump(filesize('C:\\test.txt')); Expected result: ---------------- int(7) int(7) Actual result: -------------- Warning: file_get_contents(ftp://...@ftp.example.com/file#1.txt) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: FTP server reports 550 /file : The system cannot find the path specified. in... int(0) int(7)