Needs work
Project:
Plupload integration
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Feb 2011 at 18:38 UTC
Updated:
11 Mar 2012 at 22:07 UTC
Jump to comment: Most recent file
Comments
Comment #1
justintime commentedThanks for the patch, marking issue as 'needs review'.
Comment #2
shawn_smiley commentedHere is a patch for the Drupal 7 version of PLUpload.
You can control the max_upload_size and chunk_size settings either through the settings.php file or through the Variables module (the variables module is not required in order to use this patch).
Comment #3
shawn_smiley commentedOops, left some debugging code in the previous patch. Here is a new patch without the debugging code.
Comment #4
crea commentedSubs
Comment #5
randallknutson commentedJust ran into this. At the very minimum I'd recommend changing the max_file_size to:
'max_file_size' => format_size(file_upload_max_size())That way it will match whatever the file_upload_max_size of the system is. Hard coding it to 10mb will cause an error if it is set too low and will not allow anything over 10mb if it is set higher.
Comment #6
crea commentedBecause the module works for uploading imagefield files, we should just use configured ImageField file size settings
Comment #7
slashrsm commentedAbout D7 version:
We could add combination of both approaches: allow user to select max file size or to use system settings (which should be default, IMO). We should also explain how to control this settings in README.txt.
Comment #8
atlea commented@randalknutson: Using file_upload_max_size as a default is a good idea. But note that because Plupload use chunked uploads, the PHP limits really does not apply (hooray!). format_size is not a good idea, at least without a language code as it could possibly translate KB, MB, etc to other abbreviations as it is passed through t(). Either way; Plupload can use byte as input - so no need to format the value.
@crea: This is a nice thought. The field using the element should control this setting per instance. The D7 version only has an element, and no fields, so a sane default would be all that is needed.
@slashrsm: I concur. Since field/forms using the element can control this, file_upload_max_size() should probably be the default. If you look at how filters (file extensions) are implemented in pre_render, using values from #upload_validators, file size should probably be set the same way? Then regular filed validations could be used, and one would not have to know how to set Plupload settings through #plupload_settings.
I have (just) implemented this functionality into http://drupal.org/sandbox/atlea/1414774. Since this is a field wrapper for the Plupload element (D7), I am using the (file) field instance settings to set the max size, and passing this to Plupload (element) using #plupload_settings (any Plupload settings can be set here, not just the ones that the Plupload module has defaults for). This works great. Thanks to chunked upload this can even be set higher than PHP file size/post size limits. I have not implemented client side resize (server side works) yet. I believe this should probably also (for D7) be left to the field/form implementing the Plupload element? Either by using #plupload_settings, or more ideally respecting file_validate_image_resolution if set in #upload_validators.
Comment #9
slashrsm commentedI think this also make a good point about this: http://drupal.org/node/1230632#comment-5669002
The more I think about configuration of this values, the more I am convinced, that we do not need it in D7. This module provides form element, which will always be used by other modules. I think we should leave them to implement UI configuration. Multiple configuration places for the same thing will just confuse users.