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

Unable to upload large binary file using REST / Platform UI

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 1.6.2, 1.7.2, 1.8.1, 1.9.0
    • Fix Version/s: Customer request, 1.13.3, 1.7.8
    • Labels:
      None
    • Environment:

      Mac OSX 10.12.4 (16E195)
      Firefox 52.0.2
      Chrome 57.0.2987.133
      Opera 44.0.2510.1218
      Safari 10.1 (12603.1.30.0.34)

      Description

      If use File FieldType without a max file size restriction, it's impossible to upload a binary file larger than 500mb (exact size depends on browser).
      It happens because PlatformUI tries to convert the file into base64 and file size exceeds max blob size.

      Chrome & Opera:
      Shows information about uploaded file. After click on Publish returns error message: An error occurred while publishing the draft

      Firefox:
      Nothing happens on UI. An error message is visible in the console. See attachment.

      Safari:
      Browser crashes . If a draft was not saved before, all data from other fields will be lost.

      Furthermore, a response from API contains an incorrect error message - problem isn't related with MimeType. MimeType can not be recognized because nothing was send to backend.

      API response
      {"ErrorMessage":{"_media-type":"application\/vnd.ez.api.ErrorMessage+json","errorCode":500,"errorMessage":"Internal Server Error","errorDescription":"An exception occurred while executing 'INSERT INTO `ezbinaryfile` (`contentobject_attribute_id`, `filename`, `mime_type`, `original_filename`, `version`, `download_count`) VALUES (:placeholder1, :placeholder2, :placeholder3, :placeholder4, :placeholder5, :placeholder6)' with params [\"491\", false, null, \"rtmp.mov\", 1, 0]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mime_type' cannot be null","Previous":{"_media-type":"application\/vnd.ez.api.ErrorMessage+json","ErrorMessage":{"_media-type":"application\/vnd.ez.api.ErrorMessage+json","errorCode":500,"errorMessage":"Internal Server Error","errorDescription":"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mime_type' cannot be null","Previous":{"_media-type":"application\/vnd.ez.api.ErrorMessage+json","ErrorMessage":{"_media-type":"application\/vnd.ez.api.ErrorMessage+json","errorCode":500,"errorMessage":"Internal Server Error","errorDescription":"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mime_type' cannot be null"}}}}}}
      

      Update: Even if blob size limit isn't exceeded, then it is not possible to save binary file which is bigger than PHP memory_limit value.
      Every binary file is converted to a string using base64, then it goes to the PlatformUI controller which handles it this way:
      https://github.com/ezsystems/PlatformUIBundle/blob/master/Controller/Rest/ContentController.php#L137
      and finally, Symfony ends-up trying to do `file_get_contents` and assign the value to the property what is not possible due to lack of memory:
      https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/HttpFoundation/Request.php#L1526

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              kamil.madejski@ez.no Kamil Madejski
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: