Reputation: 510
I want to add an extra field to the Upload Files widget, how I can do that?
What I actually have:
_config_form.htm
FileUpload.php
Error on saving:
Upvotes: 1
Views: 667
Reputation: 31
You should not edit any core files directly, better way would be to create plugin, inside plugin create formwidget that extends from FileUpload.php give your widget an alias and use that alias instead of fileupload.
To add another field before $file->save() just override onSaveAttachmentConfig() method and that's it.
Problem with FileUpload is that it reads config from partial and not from config so it's hard to extend view that's pesented to users.
At least it was case with me, a had to add tags, taglist field and image crop inside multi image upload widget.
It was really complicated.
Upvotes: 1
Reputation: 510
The problem was on the name of the new field...
So If change "data" to for example "params" all will work great:
Upvotes: 1