No announcement yet.

Unable to attach files greater than 10MB

  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to attach files greater than 10MB

    In IE (using 6.0) if anyone tries to attach a file larger than 10MB the attachment manager shows a "The Page cannot be diplayed" error with the reason being "Cannot find server or DNS Error". In Firefox (using 1.0.6) the transfer just stops without an error (but the "uploading file" message remains in the window.) The error/problem seems to happen after the data is transfered (I was testing from a remote site and the error would occur after about 7 minutes which is about right for a 10MB file; within the LAN the error happens almost immediately.) Attachments under 10MB work fine, right up to 9.99MB files.

    Here are some of my settings:

    Attachments are being stored in the filesystem.
    Message Attachment Options -> Limit Space Taken Up By Attachments (Total) = 0
    Attachments -> Extensions & Sizes -> all extensions have maximum filesize of "none"
    Usergroups -> all groups have "Space (in bytes) that a user's total attachment usage may consume" = 0

    Maintenance -> Diagnostics -> Uploads:
    file_uploads: On
    open_basedir: None
    safe_mode: Off
    upload_tmp_dir: None
    upload_max_filesize: 100.00MB

    Also, for php.ini the memory_limit is set to 32MB



  • #2
    What is the script exectioin time in php and how is php being run?


    • #3
      In addition to the vB settings, the allowed size of the attachments depends on the PHP and MySQL configuration. You may need to check and change the upload size for both PHP and for MySQL. Note, you'll need to have root access to the server to do this (or have your host do it.) Make these changes to php.ini:

      upload_max_filesize = xM

      ..and my.cnf (or my.ini for Windows systems)


      Change it to the size ('x') you want in Megabytes. Restart the webserver and MySQL after making these changes.

      Note: You may also need to increase the max_execution_time and max_input_time variables in php.ini.

      Also you might want to take a look at this for other settings that affect file uploads:
      Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
      Change CKEditor Colors to Match Style (for 4.1.4 and above)

      Steve Machol Photography

      Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


      • #4
        Thank you for the replies. I made some changes and now the problem occurs for attachments that are greater than 38MB. Some of you are probably wondering so I should say that there is a high probability that our users will need to attach files greater than 38MB. Chances are we will be safe with a limit of 50MB, but I would prefer the 100MB limit.

        I am running Linux (Fedora core 1)

        I changed the following:

        in php.ini:
        upload_max_filesize = 100M (actually 100M was the original setting)
        post_max_size = 110MB (was 8M)
        memory_limit = 115MB (was 16M)
        max_execution_time = 120 (was 30)
        max_input_time = 180 (was 60)

        in my.cnf
        set-variable = max_allowed_packet=110MB (had to add this under [mysqld] section)

        Also you might want to take a look at this for other settings that affect file uploads:
        In regards to the instructions in the other threads, I was unable to find a "LimitRequestBody" in httpd.conf. Also, I do not have a php.conf file in my
        /etc/httpd/conf.d/ directory. So, I have no idea what I should do with the LiitRequestBody setting.

        The amount of time it takes for the error to occur when connecting through the LAN is less than 10 seconds. Furthermore, I connected through a remote computer that was able to successfult attach a 9mb file even though it took over 9 minutes to do so. Therefore it seems that a timeout isn't happening.

        Thanks again for the replies.
        New Member
        Last edited by quepasa; Wed 9 Nov '05, 2:06pm.


        • #5
          I found information about the "LimitRequestBody" variable for httpd.conf. The default is unlimited. So, defining the variable in httpd.conf is unnecessary in my case.

          I have telneted to the server and looked at the directory that php uses for upload_tmp_dir. During uploads using vBulletin I can see the file being placed in the directory, and as I refresh the directory listing I can see that the filesize increases until the complete file is uploaded. Then the file disapears from the temp directory (apparently being moved to somewhere else in the system.) There is a couple of seconds of a delay, and then I get the error in the attachment manager window. Does anyone know the exact steps an upload goes through during the upload process for vBulletin? I think I've ruled out the problem having to do with php settings and httpd.

          I have Mambo installed on the same computer as vBulletin. There is a component that allows admins to upload files into a repository called ReMOSitory. I am able to upload files up to 100MB using reMOSitory with no problems at all. So, does anyone know what the difference is between reMOSitory's way of transfering files versus vBulletin's? If I look at php's upload_temp_dir during reMOSitory file transfers I can see the file being placed in the directory, the file-size increasing until it reaches the size of the attachment I am uplaoding. Then it disapears from the temp directory, there is a two second delay, and then I get the "file transfer succeeded" message from Mambo.

          Another observation: I have absolutely no errors in vBulletin when I try to attach multiple files whose total size is greater than 100MB.

          Is there a "debug mode" for vBulletin where it logs everything that is going on? Maybe I can figure out what the problem is by comparing the log during a successfull 10MB upload versus an unsuccessful 50MB upload.

          I would appreciate any help anyone can give me. Being able to attach large files is a requirement of the board, and I am unable to open it to my users until this problem is solved.


          • #6
            vBulletin simply copies the file over to the destination directory at that point. You should disable memory_limit by setting it to -1 though.


            • #7
              You should disable memory_limit by setting it to -1 though.
              This did fix the problem with uploading files with vBulletin. However, doesn't disabling memory_limit create a serious security issue, particulalry with Denial of Service Attacks?

              I played around with the memory_limit setting and found that the setitng needs to be 350MB in order to be able to upload a 100MB file using vBulletin. Why would vBulletin need to use more than 3X the size of a file in order to upload it? Is there another setting that would cause vBulletin to behave this way? Is vBulletin wrapping/encoding files (although if I look at my attachment directories I see that the attachments don't take up significantly more space than they should.)

              Thanks for the responces!


              • #8
                You could try setting the memory_limit to -1 for that operation itself.


                • #9
                  We use a datamanager (api) for dealing with attachments and it introduces overhead with multiple copies of the attachment in memory at once. I'll go through the DM again to see if there is any copies of the attachment in memory that can be changed to references.


                  • #10
                    Originally posted by Zachery
                    You could try setting the memory_limit to -1 for that operation itself.
                    I'm sorry, but I do not understand what you mean, or how to do this. Are you saying that there is a way to define memory_limit for different processes/operations? That would be nice.


                    • #11
                      you should be able to use ini_set to define a specific setting like memory_limit during a function, somthing like @ini_set('memory_limit','-1'); (check the specific syntax) the @ sign is to hide an error message if it causes one though.


                      • #12
                        Originally posted by Zachery
                        you should be able to use ini_set to define a specific setting like memory_limit during a function, somthing like @ini_set('memory_limit','-1'); (check the specific syntax) the @ sign is to hide an error message if it causes one though.

                        Ok, after googling ini_set I found that the syntax should be:
                        @ini_set('memory_limit', '-1');

                        (There is a space after the comma).

                        I included this line in the newattachment.php file within the "SET PHP ENVIRONMENT" section. This is a vBulletin file that can be found in the main forum directory. After placing this line I am able to attach large (100MB+) files using vBulletin even though my memory_limit in php.ini is set at 16M.

                        There is also an attachment.php file, but including the ini_set line in this file doesn't seem to affect uploads, so I don't have the ini_set line in that file.

                        Are there other files involved with attachments that should have the ini_set line?

                        Large attachments possible + More Secure php.ini = Happy Admin!!

                        Thanks again for all the help!


                        • #13
                          Fantastic! I've been trying to fix this problem for a long time now. Thanks!


                          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.