Closed (fixed)
Project:
FileField Sources Plupload
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
27 Apr 2012 at 00:56 UTC
Updated:
6 Sep 2013 at 06:41 UTC
Jump to comment: Most recent file
Comments
Comment #1
atlea commentedHum. I will have to look into limiting the number or files. I'll add this to the todo!
Comment #2
burgs commentedAtlea, you are a legend. It looks like the plupload team themselves don't really have an elegant, documented solution for this, so that might be a small issue. Let me know where I can help.
Comment #3
osmanI believe I have a solution. Please review and test it.
Edit: There are some proper labeling issues, and typos, etc. But the functionality should be ready for reviewing.
Comment #4
adam_b commentedWorks well for me - many thanks :)
Comment #5
atlea commentedNice one! I'll try to have a new dev that includes this functionallity over the weekend. :)
Comment #6
Tsubo commentedHas patch #3 been committed yet?
Comment #7
trebol commentedI cant apply the patch by atlea, because the code of the patch its different of the code i see in my module. i got the last version installed, and this option is not added.
Any valid script to enable single file upload?
Comment #8
antipode commentedgreat - I tried something myself but was not aware of the $element['#attached']['js'][].
however - I still get the option to add more files when uploading. I thought this patch will allow only for 1 file to select and upload.
Comment #9
osmanHere is an updated patch.
If cardinality is set to "1", Plupload is forced to select only one file at a time in "file select" dialog windows by adding
multi_selection: FALSEandmultiple_queues: FALSEsettings to plupload object.If cardinality is set to anything but unlimited; number of the files in the queue is checked on "
QueueChanged" event.Files exceeding the limit are removed from the queue instantly. Meanwhile, Add files link/button is kept hidden when the number of the files in the queue matches the (cardinality) limit.
I tested this with different cardinality settings. But please do test it yourselves as well.
Comment #10
osmanForgot to mention; with this patch cardinality value is passed to plupload object as a setting. So it would be available at all times.
Later it is used in plupload.js as
pluploadSettings.cardinalityin QueueChanged event.Comment #11
muschpusch commentedok this patch is awesome because of two reasons:
- single file upload (my usecase i use plupload because of chunking large files)
- cardinality is checked before uploading on plupload side
Comment #12
muschpusch commentedok just some little adjustments to the label
Comment #13
atlea commentedPatch seems to work nicely. I have added it to the dev-version.