php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11504 file uploads with forms have problems
Submitted: 2001-06-15 11:38 UTC Modified: 2001-06-17 13:54 UTC
From: dgalli at sda dot com dot ar Assigned:
Status: Closed Package: *Programming Data Structures
PHP Version: 4.0.4pl1 OS: WIN NT 4.0 - Apache
Private report: No CVE-ID: None
 [2001-06-15 11:38 UTC] dgalli at sda dot com dot ar
This code upload files and create a list of files uploaded. But sometimes when the form is sended (when try the 2nd or 3th round trip) all variables loose your values. the PHP.ini configuration is the default.

*********************************test1.php******************
<HTML>
<HEAD>
	<Title>Upload</Title>
</HEAD>
<BODY>
<?PHP 
	if (is_uploaded_file($userfile))
	{
		copy($userfile, "upload/".$userfile_name);
		$FileListName[]	= $userfile_name;
		$FileListSize[]	= $userfile_size;
	};
?>
<form Action="test1.php" Method="POST" ENCTYPE="MULTIPART/FORM-DATA" name="form1">
	<?PHP 
		for($i=0;$i<count($FileListName);$i++) 
		{
            echo "\n$FileListName[$i]\n";
			echo "$FileListSize[$i]\n";
		};
		echo count($FileListName);
		for($j=0;$j<count($FileListName);$j++)
		{
			echo "<input type=\"hidden\" name=\"FileListName[]\" value=\"$FileListName[$j]\">";
			echo "<input type=\"hidden\" name=\"FileListSize[]\" value=\"$FileListSize[$j]\">";
		};								
	?>
	<br>
	<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="2000000">
	<input type="file" name="userfile" size="25" >
	<input type="submit" value="Agregar" name="B2">
</form>
</BODY>
</HTML>
************************************************************
Sorry for my english...

Dante Daniel Galli

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-17 13:54 UTC] sniper@php.net
I can't reproduce this. Please try with PHP 4.0.5

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 17:01:28 2024 UTC