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 10 of 10
  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lahore, Pakistan
    Posts
    150
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Upload file problem

    I make a function in PHP which uploads a file to a server. BUt i have a one huge file, its size is 10MB. When i upload it(i have a broadband connection 512 KBPS)
    it gives error.

    It there any other method in PHP, to uplaod a larger file. Or is there any other soultion.

    plz reply
    Eshban

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,773
    Thanks
    19
    Thanked 155 Times in 146 Posts
    what do you have the maximum file size set to in your script? Or do you not have it set?
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #3
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lahore, Pakistan
    Posts
    150
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Problem

    Hi,

    i did n't set any size, php using its default size. How can i fiz this problem

  • #4
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The only way to fix it is to specify a higher maximum size in your php.ini, you can find it under the "upload_max_filesize" directive.

  • #5
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,773
    Thanks
    19
    Thanked 155 Times in 146 Posts
    Well I usually ad this line of code to my HTML upload form:

    Code:
    <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
    where value is measured in bites...so the max file size here is 2 MB...

    I know there is a way, and probably a more secure way (since it's server side, it's harder to be hacked), of setting max file size using PHP, but I never got around to learning that.....I probably should....

    anyway, to make your script functional, you can use that HTML code....but eventually I would look into the PHP way of setting max file size, cause its more secure....

    maybe I'll look for you and see, if I'm feeling generous...
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #6
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lahore, Pakistan
    Posts
    150
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I use it also, but still it says, maximum file size exceeds. SO how can i upload a file size of 10 MB.

    plz reply
    eshban

  • #7
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,773
    Thanks
    19
    Thanked 155 Times in 146 Posts
    The only way to fix it is to specify a higher maximum size in your php.ini, you can find it under the "upload_max_filesize" directive.
    dilinear, if you don;t have access to the php.ini, is there a way to override the remote server's php.ini by uploading your own makeshift php.ini text file to the server, with the change in the directive in the text file.....

    just curious.....

    if not, it looks like you need to have administrative privileges to your server to change the directive (in the php.ini)...i guess that's the only way
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #8
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Like I said above, you have to specify your filesize in php.ini in upload_max_filesize, you might be able to set it via .htaccess, I've never tried but it's probably worth a try if you don't have access to php.ini.

    You can find out exactly where the error is being generated, by the way, by echoing the error code $_FILES['userfil'['error'] - if it's a 1 then the php size limit is the problem, if it's a 2 then the html limit is the problem.

    You can also check your php size limit by doing a php_info(); function call - look through the info for upload_max_filesize and you will instantly see if that's the issue.

  • #9
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by chump2877
    dilinear, if you don;t have access to the php.ini, is there a way to override the remote server's php.ini by uploading your own makeshift php.ini text file to the server, with the change in the directive in the text file.....
    I don't think so unfortunately. I think it's possible to change via .htaccess but only if your host allows it. The reason I say this is because I had to request one of my shared hosts increase my limit from 2MB to 5MB recently and I'm sure they said something about having to make the request because they've restricted the ability to change it via .htaccess

  • #10
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    eshban, if you're on *nix try creating a unix-formatted .htaccess file with the following code:
    PHP Code:
    php_value upload_max_filesize 50m 
    and put it in your root directory. If that doesn't work and you don't have access to the php.ini then all I can suggest is either asking your host to increase it for you or finding a new host


  •  

    Posting Permissions

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