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.

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

UploadField with dateTime appended to filename


Go to End


2 Posts   1033 Views

Avatar
marc79

Community Member, 65 Posts

11 December 2013 at 12:08am

Hi

I'm trying to find a way of ensuring that users can't overwrite and existing uploaded file so that we will always have a full history of changes made.

My first thought was to append the current date/time to the filename at upload meaning it would always be unique. However I can't seem to find a way of doing this. Is it possible?

Or if there is another, better way I'd been keen to hear. Maybe adding a version or ID number to the filename.

Any help or suggestions would be greatly received.

thanks

Marc

Avatar
swaiba

Forum Moderator, 1899 Posts

11 December 2013 at 12:17am

Sounds like "Versioned Files" (versioned like the sitetree) might be what you are looking for...

https://github.com/silverstripe-australia/silverstripe-versionedfiles