UploadField - SS4.2.1 - any user restriction options?

Silverstripe Version:

How can I restrict what users can do with UploadField like I could in SS3?

Now that setCanAttachExisting is depreciated how can I stop users browsing the file system?

I’d like them to be able to be able to Upload an image, unlink (remove) an image and then upload a new one only.

They should not be able to browse the directory the images are uploaded and certainly not be able to navigate away from that directory.

Is there a way to do this in SS4.2.1?

These are logged in users who have control over what is effectively a member page which is a standard DataObject.



Found it :slight_smile:


I guess speaking “out loud” on here forced me to have a really good look at the API page again :slight_smile:

It’s one of the last things I’ve been unable to do for a major SS3 to SS4 update. I’m really relieved to have sorted that one.

It’s been one heck of a journey but SS4 is just as awesome as SS3. It’s really forced me to tidy up my code.