beate-neu Posted November 20, 2018 Share Posted November 20, 2018 Hello, I'm importing pages from the last CMS into PW. This works very well with a database dump. But I'm having problems saving the images and downloads for each page. I copied all of the files in a folter I specified in $upload_path: ... $page->save(); $imagegallery = explode(",", $value['filelist1']); foreach($imagegallery as $filename) { //$page->imagegallery[] = $upload_path . $filename; //$page->imagegallery->add((string)$upload_path . $filename); $page->set("imagegallery", $upload_path . $filename); } $page->save(); none of the lines worked :( Is there a trick I don't know? Thanks, Beate Link to comment Share on other sites More sharing options...
Zeka Posted November 20, 2018 Share Posted November 20, 2018 $page->setOutputFormatting(false); foreach($imagegallery as $filename) { $page->imagegallery->add($upload_path . $filename); $page->save(); } Though I'm not sure that it's obligatory to call $page->save() in the loop. 1 Link to comment Share on other sites More sharing options...
beate-neu Posted November 22, 2018 Author Share Posted November 22, 2018 Zeka, thanks, this worked, also with save in foreach. ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now