Ivan
Ivan

Reputation: 510

Add extra field on "File Upload" widget of OctoberCMS

I want to add an extra field to the Upload Files widget, how I can do that?


What I actually have:


Error on saving: IMG3

Upvotes: 1

Views: 667

Answers (2)

DonVitoCorleone
DonVitoCorleone

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

Ivan
Ivan

Reputation: 510

The problem was on the name of the new field...

So If change "data" to for example "params" all will work great:

enter image description here

Upvotes: 1

Related Questions