ID: 31398 Updated by: [EMAIL PROTECTED] Reported By: lobo235 at gmail dot com Status: Open Bug Type: Documentation problem Operating System: Windows and Linux PHP Version: 4CVS-2005-01-04 (stable) New Comment:
I can't reproduce this on PHP 5.0.2 with php.ini-dist, Apache 2 and Windows. "lobo235's fam.jpg" becomes "lobo235\'s fam.jpg" or "lobo235's fam.jpg" with magic_quotes_gpc=Off. Maybe it's PHP 4 specific. Previous Comments: ------------------------------------------------------------------------ [2005-01-05 09:03:22] [EMAIL PROTECTED] Yeah, I agree... the documentation should mention this issue. ------------------------------------------------------------------------ [2005-01-04 22:49:51] lobo235 at gmail dot com If I remember correctly, PHP used to handle filenames of this type just fine. I know that other scripting languages are able to handle these types of filenames just fine. Is there any way that this can be implemented in a future version? It seems like if an array element is going to be set to the "original" file name it should work all the time or not at all. It is misleading when one reads the documentation concerning Handling file uploads. It says: $_FILES['userfile']['name'] The original name of the file on the client machine. To me this says that no matter what they've named their file this array element always gets set to the name of the file on the client machine. Maybe a change is needed in the documentation. ------------------------------------------------------------------------ [2005-01-04 09:12:34] [EMAIL PROTECTED] This is a security measure. Also, the RFCs do not require browsers to pass the full orginal name to an application in the first place, do you should never rely on this field. ------------------------------------------------------------------------ [2005-01-04 00:23:22] lobo235 at gmail dot com I forgot to mention that I tried this with Apache2 on Windows and with Apache1 on linux with the same results in both environments. ------------------------------------------------------------------------ [2005-01-04 00:20:56] lobo235 at gmail dot com Description: ------------ The full name of the file is not put into the $_FILES[] array when a file is uploaded that has an apostrophe in the name. For example: lobo235's fam.jpg The first part of the filename including the apostrophe is cut off so it shows as: s fam.jpg I am using $_FILES['userfile']['name'] to try and get the original file name when I see this. Reproduce code: --------------- <?php echo "<h2>".$_FILES['userfile']['name']."</h2>"; ?> <form method="post" action="p.php" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="7000000" /> Attach this file: <input name="userfile" type="file" size="32" /><br />(<i>Max Size: 7 Megabytes</i>)<br /> <input type="submit" name="attach" value="Attach" /> </form> Expected result: ---------------- The full name of the file uploaded including the apostrophe. Actual result: -------------- The first part of the filename is cut off including the apostrophe. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31398&edit=1