If the file upload in Magento 2 (in this case: Magento 2.2.5) aborts when attempting to upload a video file in a static block, this may be due to an excessively large post_max_size. In this particular case, the PHP parameter in php.ini was set to 2048M, i.e. 2 gigabytes. If you look at the error displayed in the console when attempting to upload a file, you will see a message stating that the compiler encountered an "Unexpected token" while processing the program code and can no longer continue because of it.

 

 

This unexpected character is encountered by the compiler directly after a max_file_size value, which was previously calculated from the php.ini setting (essentially, the size designation "M" or "G" is simply removed here and the value is multiplied by 1024 or 1024 * 1024, respectively).

 

In our case, the value that was supposed to be passed here was therefore 2,147,483,648. At first glance, this does not look problematic, but it is because the function that converts post_max_size passes an INT value. Since the memory limit for this is reached at 2,147,483,647, the integer representation in the querying function fails, causing invalid characters to be detected and the compiler execution to stop.

 

So, let's change "int" to "float"

 

in vendor\magento\framework\Convert\DataSize.php

 

and everything is fine (yes, this is a core modification, but putting more effort into this is not worthwhile; we hope that this issue will be fixed in future versions!).