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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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

Rename file on Upload


Go to End


2 Posts   1423 Views

Avatar
Andre

Community Member, 146 Posts

2 May 2012 at 6:23pm

Hi there,

Does there exist an easy way to rename Files when they are beeing uploaded?

At best by using an extension or a decorator, to make it usable with uploadify Plugin.

Regards

Andre

Avatar
Willr

Forum Moderator, 5523 Posts

4 May 2012 at 6:43pm

You can make an extension to the File object and override the onBeforeWrite function. Here's an example of an image extension for 2.4 that I use onAfterWrite() https://gist.github.com/2298046