php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58929 Location of the HIDDEN vars prevents uploads
Submitted: 2009-10-29 17:52 UTC Modified: 2009-10-30 02:46 UTC
From: shawn dot britton at yahoo dot com Assigned:
Status: Wont fix Package: uploadprogress (PECL)
PHP Version: 5.0.2 OS: Unix
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 — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
29 + 26 = ?
Subscribe to this entry?

 
 [2009-10-29 17:52 UTC] shawn dot britton at yahoo dot com
Description:
------------
I have the script hosted at www.rackspace.com on their cloud sites service which has this library installed.  I have noticed that the order of the hidden variables in relation to the file field determines if the upload is successful or not.  If the "UPLOAD_IDENTIFIER" and "MAX_FILE_SIZE" is before the file info, the progress bar works fine, but the upload does not work (TMP directory never gets the file).  However, if I put the hidden vars after the file field, the upload works perfectly, but the progress bar does not work.

Reproduce code:
---------------
<?php 
if ($_POST['submitted'] == '1') {
	echo "<pre>";
	var_dump($_FILES);
	echo "</pre>";	
}
?>
<form action="delme.php" method="post" enctype="multipart/form-data" >
	<input type="file" name="upload_file" id="upload_file" size="55" />
	<input type="hidden" name="submitted" id="submitted" value="1" /><br />
	<input type="submit" name="continue" id="continue" value="Upload" />
	<!-- if the following lines are at the top of the form, the upload does not work -->
	<input type="hidden" name="MAX_FILE_SIZE" value="4096000000" />
	<input type="hidden" name="UPLOAD_IDENTIFIER" value="<?php echo md5(time());?>" />
</form>

Expected result:
----------------
I would expect the upload to work and the progress be reported back.

Actual result:
--------------
The above code will upload the file, but the progress is not reported back.  If the hidden vars are moved to the top of the form, the progress works, but the uploaded file is nowhere to be found.

Review of the $_FILES shows that there was no temp file created.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-30 02:46 UTC] chregu@php.net
Yes. The location of the HIDDEN var does matter. For 
technical reasons, we can't change that.

See also
http://blog.liip.ch/archive/2009/03/11/upload-progress-
meter-common-issues-and-some-answers.html
for soe of the most common problems

Why it doesn't work at all even if the order is correct, I 
don't know. Did you try with the demo files from 
http://cvs.php.net/viewvc.cgi/pecl/uploadprogress/examples/ 
and see what they report?

You say, that you're using PHP 5.0.2. It's not gonna fly 
with that one, you need at least 5.2
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 15:01:56 2024 UTC