Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

PHP upload - max file size

  • 19-06-2005 06:03PM
    #1
    Registered Users, Registered Users 2 Posts: 2,933 ✭✭✭


    I want to upload files about 20 meg or bigger onto my server using PHP. I have the upload working but cannot get large files uploaded.

    In the html form I have
    <input type="hidden" name="MAX_FILE_SIZE" value="20000" />
    

    In the php.ini file on the server I have
    upload_max_filesize = 20M
    
    and
    post_max_size = 20M
    
    and
    memory_limit = 128M
    

    Is there something else I'm missing?
    I get an error code of 2 which tells me there is a problem with MAX_FILE_SIZE.

    Any help would be great. Thanks.


Comments

  • Registered Users, Registered Users 2 Posts: 9,446 ✭✭✭RobertFoster


    Have you got the hidden field before the upload field?


  • Registered Users, Registered Users 2 Posts: 7,742 ✭✭✭mneylon


    Obvious question, but have you restarted apache?


  • Registered Users, Registered Users 2 Posts: 2,933 ✭✭✭Sniipe


    <form enctype="multipart/form-data" action="upload.php" method="POST">
           <input type="hidden" name="MAX_FILE_SIZE" value="200000" />
            Upload: <input name="userfile" type="file" />
        <input type="submit" value="Send File" />
    </form>
    

    And I've restarted apache :(

    Still no joy.


  • Registered Users, Registered Users 2 Posts: 7,742 ✭✭✭mneylon


    Ask your hosting company to help you


  • Registered Users, Registered Users 2 Posts: 4,003 ✭✭✭rsynnott


    You may want to up your max_Execution_time. It's also possible for Apache to limit this, as far as I know; have a look at your conf file.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 7,742 ✭✭✭mneylon


    True.
    If you up the error reporting to something more verbose it might give you more useful information.


  • Registered Users, Registered Users 2 Posts: 1,268 ✭✭✭hostyle


    Sniipe wrote:
    <input type="hidden" name="MAX_FILE_SIZE" value="20000" />
    

    Thats 20,000 bytes.

    http://ie2.php.net/features.file-upload

    The error message you are getting is entirely correct.


  • Registered Users, Registered Users 2 Posts: 2,933 ✭✭✭Sniipe


    Thank you so much hostyle. For some reason I thought it was KB. That did the job. Thanks again.


  • Registered Users, Registered Users 2 Posts: 4,003 ✭✭✭rsynnott


    Unless your users all have unreasonably fast internet connections you should probably still raise the execution time...


  • Registered Users, Registered Users 2 Posts: 2,933 ✭✭✭Sniipe


    thanks rsynnott,
    I'm just playing around with PHP on localhost. I wanted to be able to do upload properly. Thanks 4 the help all. I'll keep max_Execution_time in mind tho.


  • Advertisement
Advertisement