Home Ask Login Register

Developers Planet

Your answer is one click away!

Jack O'Connor February 2016

Moving secure files out of assets to a secure folder

By default (and as far as I know this can't be changed) files are uploaded to /assets at all times and folders beneath assets. I have a secure set of files that need to be uploaded, as I can't find a way to change where they are uploaded to, I figured on after write I could try and move the file to a secure directory. I have tried using

move_uploaded_file($file->Name, '\/secret\/');

to move the file to a root folder called 'secret' but this doesn't seem to change anything. Perhaps I am doing something wrong on that behalf or it just doesn't work. If anyone has done this before or knows how, I would appreciate any help I can get. Thanks.


3dgoo February 2016

In SilverStripe it is not currently possible to move a CMS controlled file or folder outside of the assets folder.

An alternative is to use the Secure Assets module to add access restrictions to folders that mirror the access restrictions of SiteTree pages.

Once this module is installed you can change the permissions of your secure folder so that only certain logged in users can access the folder and the files in it.

Post Status

Asked in February 2016
Viewed 3,816 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life