Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-15083

No warning is given when uploading file and size exeeds post_max_size [PATCH]

    XMLWordPrintable

Details

    Description

      Hi

      The ezbinaryfile has support for detecting if file is bigger than upload_max_file_size. However, ezbinaryfile doesn't detect if file size exceeds post_max_size.
      This is not possible to detect by a datatype either since all post variables are removed in such case. It therefore needs to be detected elsewhere (like in content/edit)

      Here is a patch which does the trick.

      Regarding my comment:

      if( ( (int) $_SERVER['CONTENT_LENGTH'] > $postMaxSize ) &&  // This is not 100% accurate as $_SERVER['CONTENT_LENGTH'] doesn't only count post data but also other things
      

      In PHP's source code you have this (main/rfc1867.c):

      if (SG(request_info).content_length > SG(post_max_size)) {
                      sapi_module.sapi_error(E_WARNING, "POST Content-Length of %ld bytes exceeds the limit of %ld bytes", SG(request_info).content_length, SG(post_max_size));
                      return;
              }
      

      I guess SG(request_info).content_length is the size of the whole request, not only the post data. But I am not sure...Anyway, since we also check if we indeed has no POST variables I think the detection in my patch is quite OK.

      Attachments

        Activity

          People

            gl gl
            vl vl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: