Active
Project:
FileField Sources Plupload
Version:
7.x-1.1
Component:
Miscellaneous
Priority:
Critical
Category:
Support request
Assigned:
Reporter:
Created:
16 Sep 2013 at 23:17 UTC
Updated:
13 Jul 2018 at 15:48 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
omd commentedOne addendum, it seems the super user can upload files without the error message, but any other user is getting the error message. And to clarify it seems to be observing the post max size.
Comment #2
omd commentedCan get the module to work if I hack Drupal core:
I made changes to includes/file.inc (found on https://api.drupal.org/api/drupal/includes!file.inc/function/file_valida...):
Changed line 1712 from:
if ($user->uid != 1) {
to:
if ($user->uid = 0) {
This basically bypasses the file size validation check:
// Bypass validation for uid = 1.
if ($user->uid != 1) {
if ($file_limit && $file->filesize > $file_limit) {
$errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($file->filesize), '%maxsize' => format_size($file_limit)));
}
Comment #3
MixologicSetting filefield to 5000MB *does not* override the php_ini setting of 32MB. That is a hard limit set by php, and cannot be overridden by drupal at runtime.
If would like to be able to upload larger files, change the setting in php.ini. See this S.O. post for more info: http://stackoverflow.com/questions/2184513/php-change-the-maximum-upload...
Comment #4
omd commentedThat is the whole point of this module and Plupload Intergration module - allowing large file uploads, larger than php limits. No?
Comment #5
MixologicYou're right, I jumped the gun there - I thought this was the filefield queue - I didnt see it was part of the FileField Sources Plupload project.
I poked around in it and it appears as though this module doesn't actually do anything for larger file upload. It just allows the setting to be set higher, but it doesnt actually manipulate the filefield upload validators, which *are* constrained by the php.ini settings.
In order for this to actually work, it would need to manipulate the filefield upload validators and actually remove that file_validate_size check.
Comment #6
wuffers commentedFrom my understanding, that's the whole point of the Plupload library and these Drupal integration modules - to have large file uploads without having to change php.ini settings. In a shared environment it's not feasible to set post_max_size to something like 2G (besides, I'm not sure it would work either, as you'd have to most likely change max_execution_time as well to handle that amount of data). Incidentally, the Plupload integration module (plupload.module) has on line 321:
which, contrary to its documentation uses a chunk size of post_max_size instead of 1M chunks. Putting in a 2G value will mostly be asking for trouble.
I replicated this in a clean Drupal 7.23 install, with just File Field sources, FileField Sources Plupload 7.x.1.1 and Plupload 7.x.1.3, with Plupload 1.5.7 library.
php.ini has these settings:
As noted above, as the super user (uid=1), you can upload anything past the file limit of 2M (up to the limit set in the file field setting), even though it says "File limit is 2 MB"), so what #3 says is not correct. You can even see in the screenshot that my file is bigger than the post_max_size of 8M.

The file field in that content type has 500 MB set as its limit, and I've used the Plupload widget instead of the default upload one (this has the advantage of doing file size validation before upload occurs, unlike the default file upload widget).
Obviously editing Drupal core's file_validate_size function isn't ideal, and looking at the function :
Even though the file field setting says "Enter a value like "512" (bytes), "80 KB" (kilobytes) or "50 MB" (megabytes) in order to restrict the allowed file size. If left empty the file sizes will be limited only by PHP's maximum post and file upload sizes (current limit 2 MB)." and it is overridden, the "maxsize" is only using the php.ini (it seems to be taking either post_max_size or upload_max_filesize setting, whichever is smaller). Shouldn't "maxsize" be taken from the file field setting, and checked against that setting?
I don't understand enough of how all 3 modules work together and if it is possible at all to pass the maxsize setting from one of those modules for the file_validate_size function, but that seems to me the way to do it.
The hack outlined in #2 works, and using the Plupload upload widget does have file size validation, but I wonder what else breaks because it essentially bypasses any type of file size validation when we're not a super user.
Comment #7
wuffers commentedOops, didn't see your reply in #5 before I started mine.
.. and hence why OP's #2 hack in Drupal's core includes/file.inc does work. I'm just surprised that I can't see an issue for this already dealt with (either in core or one of the contributing modules) with the age of these integration modules and the amount of people using them.
Comment #8
wuffers commentedDelete/comment out these 3 lines instead
uid 0 is the anonymous user and it was matching on some conditions.
Comment #9
rbennion commentedSame issue for me. User 1 bypasses global file size check. Any other user is restricted to global max as indicated in PHP.INI.
Comment #10
xpersonas commentedSubscribing...
Comment #11
acouch commentedI was able to get around this without hacking core by
['#upload_validators']['file_validate_size']inhook_field_widget_form_alter().Not very elegant, don't have time currently for a better solution.
Comment #12
TWD commentedacouch
Could you post your code?
I have the same problem with adding image files into a body field via the Wysiwyg.
Comment #13
acouch commentedComment #14
TWD commentedThank you so much!
One more question though.
Would this code be the same for both images uploaded to a dedicated image field
AND images uploaded and embedded into a free form area like a "body" field?
I assume it would since target is the Media Module file upload widget?
Comment #15
TWD commentedSubscribing
Comment #16
socialform commentedAll of these solutions seem like temprary fixes but this has been an issue for years. It makes me wonder if everyone is having this issue or just a few. Are there people uploading large files without having this issue?
On the project page it lists as a "Core Feature": Maximum file size can be set larger than PHP limits. It clearly doesn't do this.
Can the maintainer correct the project page or provide a solution? Thanks to anyone who can shed light.
Comment #17
bwaindwain commentedI think the key word is "can". PHP and Drupal have file handling limits and this module doesn't override them. But, with this module AND some clever coding like #13 or my comment over at issue 2229693, it can be done.
Maybe this should be more clear in the module's description page.