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

First upload images to Temp, then to Final folder


Go to End


2 Posts   1233 Views

Avatar
Johnny9

Community Member, 35 Posts

31 January 2014 at 9:54pm

Hi, I want to do something like this..

I have front end form with text fields and upload fields.. User can enter text and upload images and after pressing submit button, page is created.

One problem which I have is, uploadfield uploads images automaticaly, and if user didn't press submit and leave page, page is not created, but images sits in assets folder.

How could I make that images first goes to temp folder, and after user presses Submit button, images goes to Final folder and page is created?

Thanks for any help :)

Avatar
svandragt

Community Member, 44 Posts

31 January 2014 at 11:38pm

Edited: 31/01/2014 11:38pm

To change the folder name the upload field uploads files into:

		$YourUploadField= $form->Fields()->dataFieldByName('YourUploadField');
		$folder = '';
		$YourUploadField->setFolderName($folder);

Not sure about the rest.