UploadField::isSaveable()

49 views
Skip to first unread message

Uncle Cheese

unread,
Aug 31, 2012, 9:11:51 AM8/31/12
to silverst...@googlegroups.com
When I use the "From Files" feature on an unsaved record, I get a "Forbidden" error. This is because UploadField::managesRelation() returns false, and that can be traced back to $this->form->getRecord() returning null.

Looking more carefully at the API, this should never happen because an UploadField shouldn't render when IsSavable is false.

But the isSaveable() function is curious. 

return (!$record || !$this->managesRelation() || $record->exists());

It's the first two conditions that really get me. Shouldn't it be the opposite?

Sigurd Magnusson

unread,
Aug 31, 2012, 6:50:18 PM8/31/12
to silverst...@googlegroups.com
Better still, save file to temp folder and link it/move it upon save. User friendly.

Sig

--
Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "SilverStripe Core Development" group.
To view this discussion on the web visit https://groups.google.com/d/msg/silverstripe-dev/-/KSdGokmwTpIJ.
To post to this group, send email to silverst...@googlegroups.com.
To unsubscribe from this group, send email to silverstripe-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/silverstripe-dev?hl=en.
Reply all
Reply to author
Forward
0 new messages