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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mail1 at prettyworthless dot com
New email:
PHP Version: OS:

 

 [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 14:01:30 2024 UTC