php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31503 $_FILES array returns incorrect values
Submitted: 2005-01-12 03:00 UTC Modified: 2005-01-12 09:11 UTC
From: mail1 at prettyworthless dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.10 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 - 8 = ?
Subscribe to this entry?

 
 [2005-01-12 03:00 UTC] mail1 at prettyworthless dot com
Description:
------------
If I create an input type=files in the html form
Then in the target php script use the $_FILES array to get the info
All works well - uploads work fine.

But . . . if the file name contains a single quote mark, the name from $_FILES is not correct. The resulting $_FILES['file']['name'] gives the name from the next character after the single quote to the end (like a reverse truncation). Only the single quote casues this (that I have found). The upload still works, but with a wierd file name result.

Went back and tested with 4.3.4 and it works correctly.

Reproduce code:
---------------
html upload page (test.htm):

<form action="test.php" method="post" enctype="multipart/form-data">
File: <input type=file name="file" size=30><br>
<input type=submit name="submit" value="Upload File"></form>

php processing page (test.php):

<?php
print_r($_FILES);
?>

Then try and use any file name with a single quote in it.


Expected result:
----------------
$_FILES['file']['name'] should have the file name - such as abcd'efg.txt

Actual result:
--------------
$_FILES['file']['name'] will have the cut-off name - such as efg.txt

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-12 09:11 UTC] derick@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Duplicate of bug #31398
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 07:01:32 2024 UTC