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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

"Replace File" option for Files & Images

Go to End

8 Posts   2068 Views


Community Member, 80 Posts

13 February 2010 at 2:40pm

So in the CMS if I have a photo uploaded, I can "replace with one from my computer"

Can this be done with Files? For example, if I update a file (say a form). Shouldnt there be an option to replace the file? I cant seem to make this happen.

Any thoughts? Am I missing something? I do have Uncle Cheese's DOM installed. Maybe something there?


Community Member, 94 Posts

4 April 2010 at 4:48pm

Edited: 04/04/2010 4:52pm


I can see that the File class has updateLinks() - but can't find any way to update the actual filesystem file via the Files & Images admin and then fire off this updateLinks() for the selected File entry in the db.

Once an admin has a bunch of links everywhere directed to a particular File, if they need to update the pdf (for example) they have to upload a new File via the admin and then go to all the pages referring to the old File and change the links.. ? That can't be right can it?

What have I missed?


Community Member, 94 Posts

14 April 2010 at 4:42pm

Still nothing on this?


Community Member, 244 Posts

14 April 2010 at 5:10pm

This functionality is part of the versioned files module - you can grab it from In the Filest & Images area, when you click on the edit button for a file a new Replace tab will show up.


Community Member, 94 Posts

14 April 2010 at 8:38pm

Outstanding! Thanks ajshort, I'll be giving this a go very shortly. Do you know if it's 2.4rc1 compatible?


Community Member, 94 Posts

16 April 2010 at 2:36am

I'm getting a few errors, firstly after /dev/build/ I tried to run /dev/tests/ but got

[Warning] copy(/path/to/website/root/www/assets/Uploads/_versions/12/Kids-2B1.ssets/uploads/kids-2b): failed to open stream: No such file or directory
GET /dev/tasks/FileVersionCreationTask

And if I now try to open the Files & Images Admin I get

[User Error] FieldSet::addFieldToTab() Tried to add a tab to object 'FieldSet' - 'BottomRoot' didn't exist.

eek! I'm running close to if not the latest 2.4. Any suggestions?


Community Member, 94 Posts

16 April 2010 at 2:44am

Ah, the first error was the result of that file not actually having an extension in its filename in the db.

Still getting the error relating to the BottomRoot tab not existing though. Going hunting now, but any suggestions welcome.


Community Member, 94 Posts

16 April 2010 at 2:55am

Unfortunately for my current timelines this appears a little too buggy out of the box.

Removed the no-extension file and changed references to "BottomRoot" tab to "Root" tab but then got the following when viewing a File and trying to replace it:

Viewing the file, versions drop down screenshot is attached.

Replacing the file,

[User Notice] Upload::setAllowedExtensions() is deprecated. Please use Upload_Validator::setAllowedExtensions() instead

Happy to help with some testing along the way but I can't use it in production just yet.


Attached Files