SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    europe
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Strange PHP file upload problem

    Hello,
    i have a form on a 3 years old website which consists of 30 file fields and a submit button. Sometimes i use all the fields to upload 30 images or only one (e.g field no 15) to upload one image etc.

    This form works for 3 years on the same server with PHP5. A few days ago no files from field 21-30 are uploaded. If i put a single file on field 1 it gets uploaded, if the same file is put on field 25 nothing happens.

    I run
    Code:
    print_r($FILE)
    and only the first 20 field file variables are passed.

    My php.ini configuration is :
    Code:
    memory limit 128M
    max_execution_time 3000
    max_input_time 60

    Is there any value in the php configuration or something else that might have caused the $FILE variable to have a limited size?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    The error log should help you to find out the cause of the problem.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    europe
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    unfortunally there is no error log, any other idea

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Not even the apache error log?

    Failing that, I would want to find out what changed on the server?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Evangelist
    Join Date
    Sep 2006
    Posts
    428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that's weird that it stops exactly at 20. I would do a find in my phpini for the number '20'. Dunno if you will uncover anything but this method helped me find a timeout problem on a site when it was timing out exactly at 6 seconds. Did a search for '6' bam, there was the setting I needed to change.

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    I suspect that the server itself is not at fault.

    If i put a single file on field 1 it gets uploaded, if the same file is put on field 25 nothing happens
    Is the PHP code retrieving all of the fields?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Enthusiast
    Join Date
    Sep 2003
    Location
    europe
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for pointing me to the apache log file. There was the error "PHP Warning maximum number of allowable file uploads has been exceeded in Unknown on line 0"

    which i found out is a new directive max_file_uploads in php.ini since php 5.3.1. Guess what the default value is .... yes 20 files. So i added max_file_uploads=30 to php.ini and everything is working.

    Thanks

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by billt View Post
    Thanks for pointing me to the apache log file. There was the error "PHP Warning maximum number of allowable file uploads has been exceeded in Unknown on line 0"

    which i found out is a new directive max_file_uploads in php.ini since php 5.3.1. Guess what the default value is .... yes 20 files. So i added max_file_uploads=30 to php.ini and everything is working.
    Well done, and thanks rustybuddy for the advice to search the config file for the magic number.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

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