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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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   762 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.