...

View Full Version : Form upload issues - won't work on larger files (not sure why)



jrinco11
05-11-2008, 06:35 AM
hey ya'll, searched around and found a bunch of posts about form upload issues, but none specifically about this...

So I'm trying to setup an form for uploading, and I have checked and made sure that the file size limits are within range (the MAX_FILE_SIZE="30000000" in the actual <form> location, and then the two listings in the php.ini (post_max_size = 16M, and upload_max_filesize = 32M) -- yet, when I try to upload a file, say of size 8mb, 10mb, etc, I get a blank results page....

here's my BASIC test code:

<test_upload.php>


<form enctype="multipart/form-data" action="test.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="30000000" />
Send this file: <input name="video_file" type="file" />
<input type="submit" name="addVideo" value="Send File" />
</form>

<test.php>

<?php
print_r($_FILES);
if ( $_POST[addVideo]){
echo "yay!";
}
else{
echo "no!";
}
?>

Now, when I upload a file, say 4mb, it works fine -- test.php shows:

Array ( [video_file] => Array ( [name] => CeCabMgr_Setup.exe [type] => application/octet-stream [tmp_name] => C:\xampp\tmp\php360.tmp [error] => 0 [size] => 4696161 ) ) yay!

however, say I upload a file of size 8mb, I get:

Array ( ) no!

and I have NO idea why! Why is it not sending the "addVideo" value via post? why is an 8mb file not working but 4mb is? any help would be GREATLY appreciated!

CFMaBiSmAd
05-11-2008, 06:44 AM
When the size of the upload file exceeds post_max_size the $_FILES array will be empty.

Edit: The following critical piece of upload information is buried under the description of post_max_size in the php manual -


If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. <form action="edit.php?processed=1">, and then checking if $_GET['processed'] is set.

Actually, the best way is to check that a post form was submitted by checking if $_SERVER['REQUEST_METHOD'] is POST and then using the empty() function to test $_FILES array.

jrinco11
05-11-2008, 06:47 AM
When the size of the upload file exceeds post_max_size the $_FILES array will be empty.

but post_max_size = 16M is greater than the 8mb/10mb/etc files I'm trying to upload

CFMaBiSmAd
05-11-2008, 06:56 AM
What does a phpinfo(); statement say the actual value is?

If your form enctype is correct, the only thing that will cause $_FILES to be empty is exceeding the post_max_size, unless your code is clearing it.

jrinco11
05-11-2008, 06:59 AM
What does a phpinfo(); statement say the actual value is?

If your form enctype is correct, the only thing that will cause $_FILES to be empty is exceeding the post_max_size, unless your code is clearing it.

phpinfo shows it as being 16m -- as far as enctype goes, what else could it be besides what I'm using?

CFMaBiSmAd
05-11-2008, 07:06 AM
That would indicate that the syntax is incorrect and the value being used is not really as displayed. Post the actual statement that is setting the value.

jrinco11
05-11-2008, 02:38 PM
That would indicate that the syntax is incorrect and the value being used is not really as displayed. Post the actual statement that is setting the value.

I'm not sure I know what you mean by the "actual statement that's setting the value" -- which value?

CFMaBiSmAd
05-11-2008, 02:51 PM
The setting that was posted, highlighted, and discussed in post number 2 through post number 5 in this thread. The only setting that is known to cause the $_POST and $_FILES arrays to both be empty.

jrinco11
05-11-2008, 03:02 PM
hmmm well, like I had said, post_max_size is set to "16M" in php.ini - I don't know of any other way to set it other than physically opening php.ini, changing it, saving it, and restarting the server.

jrinco11
05-11-2008, 03:11 PM
hmmm -- I just did a "echo ini.get('post_max_size'), and it returns with "7M" -- that looks to be the issue!! any idea why it's returning a value of 7M, when I clearly have it at 16M in php.ini (and it shows 16M on phpinfo())?

idalatob
05-11-2008, 07:32 PM
hmm.

try setting it with .htaccess.

jrinco11
05-11-2008, 07:53 PM
hmm.

try setting it with .htaccess.

bit of a n00b here... how would I go about doing that?

EDIT: figured it out -- there was already a .htaccess w/the 7M limit placed in there - changed it, and it works great! THANKS!!!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum