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

UploadField setFolderName to folder outside of assets.

Go to End



Community Member, 165 Posts

5 June 2013 at 9:20am

I have been unhappy ever since I started using SilverStripe back in v2.3 that I cannot override the folder for uploading files to a folder outside of /assets.

I often have files that must be uploaded and stored that are related to DataObjects, however these files should never show up in the AssetManager or any other CMS interface other than the one I create for managing the relationship. I know that this is hard coded to always make uploads relative to /assets.

I would like a way to configure UploadField with so that it can use one of two upload root folders. One would be assets and would be used for files meant to be accessed in the CMS for placing in Content etc. The other would be another folder that would have write access for the fileserver but would not be accessible to any other interface than the UploadField that it is set for.

I think that I may have to extend Upload class and FileField, and UploadField so that I can add this configuration parameter so that I can force UploadField to use either the public_asset root or the protected_asset root.

Has anyone accomplished something similar already? I know there is SecureFiles Module is much more complex than it needs to be. All we really need is two root folders.