php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13405 Multiple File-Upload Problem
Submitted: 2001-09-23 10:12 UTC Modified: 2001-10-28 17:13 UTC
From: leonhard dot holz at t-online dot de Assigned:
Status: Closed Package: HTTP related
PHP Version: 4.0.5 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 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: leonhard dot holz at t-online dot de
New email:
PHP Version: OS:

 

 [2001-09-23 10:12 UTC] leonhard dot holz at t-online dot de
It's just like Bug #5836, but with the "_name" - Array. If you have a couple of files to upload and the first is not set, then the array ${file."_name"} has only one key (index 0) with the name of the second (!) file. 
So when you loop through the file-array the wrong name is attached to the uploaded file.

Following function solves the problem:

function correctFileUploadBug($fp_sVarName) {

	GLOBAL ${$fp_sVarName}, ${$fp_sVarName."_name"};
	
	$aFile = &${$fp_sVarName};
	$aFileName = &${$fp_sVarName."_name"};
	
	$aNewFileName = Array();
	$j = 0;
	for ($i=0;$i<count($aFile);$i++) {
		
		if (trim($aFile[$i]) == "" || trim($aFile[$i]) == "none") {
			$aNewFileName[] = "";
			$j++;
		} else {
			$aNewFileName[] = $aFileName[$i-$j];
		}
	}
	unset($aFile);
	unset($aFileName);
	${$fp_sVarName."_name"} = $aNewFileName;
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-23 21:59 UTC] sniper@php.net
With which browser does this happen?

 [2001-10-14 14:15 UTC] leonhard dot holz at t-online dot de
IE6 Beta. I just upgraded to final release and will try again soon.
 [2001-10-14 14:23 UTC] derick@php.net
status: feeedback
 [2001-10-28 17:12 UTC] sniper@php.net
This should be fixed in CVS now. You can try the latest 
development build from http://www.php4win.com/ but
make sure it's dated after 27th of October 2001.

Also, there are some minor leaks still in the new code.
If you encounter such leaks, please send the shortest
possible code + html with which you can reproduce the leak
to php-dev@lists.php.net (or me) so we can get rid of these leaks. 

This fix will be in PHP 4.2.0.

--Jani

 [2001-10-28 17:13 UTC] sniper@php.net
You didn't mention with which system you run PHP in.
So if you do compile it yourself, get the latest
CVS snapshot from http://snaps.php.net/

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Nov 13 15:01:28 2019 UTC