Closed bouskdav closed 4 years ago
You might be able to use preinit
to save a reference to the internal settings object for later. Then alter the settings.accept
array as desired. For a simpler implementation, don't set an accept
attribute on the input
element.
Changing the underlying duplicate input
element's accept attribute would require accessing $this.data('fancy-fileupload').form.find('input[type=file]').attr('accept', 'new value')
. preinit
is called in context of this
, so it should be possible to save that context for later as well. This is a small hack to access semi-internal structures. It'll probably work fine though.
An alternative is to set up the number of instances you need of different types up front. I assume you have some sort of switching interface (radio buttons/dropdown). Then just show/hide a surrounding div to show the correct widget when the file type changes.
Updated the documentation to show how to access some of the internals. Added a reference to the settings
object to the internals for easier access. Added postinit
option for complete coverage.
Awesome man, thanks for that!
Hi,
i would really apreciate possibility to modify options on-the-fly - currently i just recreate the FFU with new options.
(e.g. accept types)
Thanks, cheers, David