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.

Customising the CMS /

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

File Uploads and Asset Manager


Go to End


2 Posts   1327 Views

Avatar
pingu

Community Member, 75 Posts

11 November 2010 at 1:28am

Edited: 11/11/2010 2:07am

So I'm trying to do something I thought was fairly uncomplex but as it turns out it's proving to be somewhat of a mission in SS, which is frustrating!

Basically:
- I have a register where users can upload their resumes via a front-end form, along with other data
- A user can only have one resume file (rtf or doc)
- If a user wants to upload a new file, the old file is removed/overwritten

Now the site administrators need to be able to search through and download resumes from the back-end. They have a specific naming convention which will allow them to match resumes with their owners easily. I have the following issues:
- Are there methods to overwrite/delete an existing asset?

The whole point of this system is to minimize their workload, so they don't want to be going in and sifting through old/obselete CVs and deleting them.

Would appreciate any feedback on the best way to achieve this.

Avatar
pingu

Community Member, 75 Posts

11 November 2010 at 3:03am

So I managed to get this working by borrowing the following from AssetAdmin:

$file = DataObject::get_by_id('File', $delegatedata->CVID);
$file->delete();
$file->destroy();