Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Multiple UploadField not resetting after upload


Go to End


1357 Views

Avatar
Devlin

Community Member, 344 Posts

26 February 2016 at 3:38am

Edited: 26/02/2016 8:55am

The UploadField does not only let you upload files but it also represents your has_many relation.

By uploading a picture, it will be uploaded to the assets folder and added to your has_many relation. The UploadField will list all the items of your has_many relation, so you can edit them or remove them from the relation.

My UploadField is set to accept up to 20 pictures
It's not to limit the number of files for an upload but to limit the number of files it lets you add to your has_many relation list.

I expect an UploadField to be empty after an upload, ready to accept new input
You could remove the relation it corresponds to. It would be a normal upload field that way. But then you will have to figure out how to manage your has_many relation ...

edit:
Looking at your code, I mean: I'd remove the GridField and edit the UploadField instead. Maybe for bigger thumbnails?. Otherwise I'd be required to implement a thirdparty upload method.

https://docs.silverstripe.org/en/3.3/developer_guides/forms/field_types/uploadfield/