Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New to the CF scene
    Join Date
    May 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

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

    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>
    Code:
    <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>
    Code:
    <?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:
    Code:
    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:
    Code:
    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!

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,044
    Thanks
    2
    Thanked 316 Times in 308 Posts
    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.
    Last edited by CFMaBiSmAd; 05-11-2008 at 06:52 AM.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    New to the CF scene
    Join Date
    May 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by CFMaBiSmAd View Post
    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

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,044
    Thanks
    2
    Thanked 316 Times in 308 Posts
    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.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    New to the CF scene
    Join Date
    May 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by CFMaBiSmAd View Post
    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?

  • #6
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,044
    Thanks
    2
    Thanked 316 Times in 308 Posts
    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.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #7
    New to the CF scene
    Join Date
    May 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by CFMaBiSmAd View Post
    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?

  • #8
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,044
    Thanks
    2
    Thanked 316 Times in 308 Posts
    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.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #9
    New to the CF scene
    Join Date
    May 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

  • #10
    New to the CF scene
    Join Date
    May 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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())?

  • #11
    Regular Coder
    Join Date
    Sep 2007
    Location
    Grahamstown, South Africa
    Posts
    237
    Thanks
    6
    Thanked 17 Times in 17 Posts
    hmm.

    try setting it with .htaccess.

  • Users who have thanked idalatob for this post:

    jrinco11 (05-11-2008)

  • #12
    New to the CF scene
    Join Date
    May 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by idalatob View Post
    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!!!!
    Last edited by jrinco11; 05-11-2008 at 08:00 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •