Results 1 to 16 of 16
  1. #1
    Join Date
    Feb 2004
    Posts
    85

    PHP File uploader, More than 2 megs?

    I heard that you can only upload a maxium file size of 2 megs with a PHP based upload script. I need an upload script for my site that can support 10 megs.

    I also heard that you can override this by adding ini_set() in the script, and change the upload_max_filesize and post_max_size.

    Well, I have no work with PHP, and I was wondering what do I EXACTLY need to put to allow files of 10 megs.

    Thanks anyone who knows

  2. #2
    Join Date
    Apr 2004
    Location
    Florida
    Posts
    82
    I have never heard this, but if you are using ini_set() then you are overriding data in the .ini file and I doubt that this is a value in it, although I am not totally sure.

    Why not just upload it via FTP?

  3. #3
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,733
    It's a server-wide php setting. You will need to discuss this with your host.
    Brad Baker www.rochen.com
    Rochen - True Premium Shared & Reseller Hosting since 2000
    Better Support: Expert support 24/7 from Red Hat and Cisco Certified Engineers
    Joomla! Core Team Member Joomla Tutorials

  4. #4
    Join Date
    Apr 2004
    Location
    Florida
    Posts
    82
    If it is a php setting then you can override it with ini_set(), but I am not sure how. I had a similar problem with a php setting that I needed to change and my host told me that I didn't have the power to change the file, but use the ini_set() to temporarly override the .ini file.

    Use phpinfo() to try and find the setting that you have to change.

  5. #5
    Join Date
    Dec 2003
    Location
    Vancouver BC, eh?
    Posts
    570
    I have read about people using exec to execute perl uploading scripts or using cgi. Perl's default upload is 35 megs, which a lot of hosting companies stick to defaults with these settings.

  6. #6
    Definitely check with your host to see the uploading limit, they should let you know what the limit is.

  7. #7
    Join Date
    Dec 2003
    Location
    Vancouver BC, eh?
    Posts
    570
    you can see it using <?php phpinfo(); ?> The default is 2 megs and I think most hosts keep it at that, unfortunately. There are some apps, like phpMyAdmin that would be nice to be able to upload 20-30 mb chunks or bigger of sql data and not have to upload then run a shell to install.

  8. #8
    Join Date
    Jan 2004
    Location
    Denver, CO
    Posts
    7
    Well, I don't think you can override it via the script because of security reasons. If you use the FTP functions in php, you still have the 2mb restriction, so that won't help.

    I had created a site a while back where people had to upload files that were over 2MB, you will have to contact your host and see if they will change this for you like I had to do, it is defined in the php.ini file of how large filesizes may be for uploading.

  9. #9
    Join Date
    Dec 2003
    Location
    Vancouver BC, eh?
    Posts
    570
    That is why I suggested looking into perl. THe syntax is similar to php and the default is set at 35mb. You might be able to run a perl script from php using exec() and bypass the file restriction or just run a cgi uploader.

  10. #10
    Join Date
    May 2002
    Location
    UK
    Posts
    2,994
    Originally posted by charmedlover
    If it is a php setting then you can override it with ini_set(), but I am not sure how. I had a similar problem with a php setting that I needed to change and my host told me that I didn't have the power to change the file, but use the ini_set() to temporarly override the .ini file.

    Use phpinfo() to try and find the setting that you have to change.
    Not all PHP settings can be over-ridden by the user. However the PHP manual does tell you which can and which can't

  11. #11
    Join Date
    Apr 2004
    Location
    Florida
    Posts
    82
    Then I would look into if you are able to override that setting, though I believe you cannot as it should be a more secure setting that others.

  12. #12
    Join Date
    Aug 2001
    Posts
    4,028
    Add this into your htaccess file:

    php_value upload_max_filesize 10M

  13. #13
    Originally posted by Mekhu
    Add this into your htaccess file:

    php_value upload_max_filesize 10M
    should there be a "*" before that?

    I.E.

    PHP Code:
    php_value upload_max_filesize 10M 
    IWDN - Really smart web developers... and me!
    More than any time in history mankind faces a crossroads.
    One path leads to despair and utter hopelessness, the other to total extinction.
    Let us pray that we have the wisdom to choose correctly.

  14. #14
    Join Date
    May 2002
    Location
    UK
    Posts
    2,994
    No need for a * there

  15. #15
    Originally posted by Rich2k
    No need for a * there
    must be thinking of something else, oops. I'm a little tired to day.
    IWDN - Really smart web developers... and me!
    More than any time in history mankind faces a crossroads.
    One path leads to despair and utter hopelessness, the other to total extinction.
    Let us pray that we have the wisdom to choose correctly.

  16. #16
    Join Date
    Aug 2003
    Location
    Chicago, IL USA
    Posts
    2,781
    Originally posted by websterworld
    must be thinking of something else, oops. I'm a little tired to day.
    lol, well, that should work, if the host allows you to, it's some server config. Default, the php.ini has upload_max_filesize = 2M
    Your host can easily edit this.
    CloudRck.com - Host on Cloudrck
    Unmetered VPS Solutions at it's finest

Posting Permissions

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