Manaus Posted February 27, 2014 Share Posted February 27, 2014 Hello, I'm trying to create a Page with a uploaded file. What I'm wondering is Do I have to create the Page first, save, then add the file? Or can I create the page, add the file then save? Just to understand the Cms logic... Thanks!!! Link to comment Share on other sites More sharing options...
kongondo Posted February 27, 2014 Share Posted February 27, 2014 http://processwire.com/talk/topic/3105-create-pages-with-file-upload-field-via-api https://gist.github.com/somatonic Link to comment Share on other sites More sharing options...
Soma Posted February 27, 2014 Share Posted February 27, 2014 If you would try it would give you an error saying that you have to first save the page, I think. Link to comment Share on other sites More sharing options...
adrian Posted February 27, 2014 Share Posted February 27, 2014 I assume you are talking a front-end form using the API? You can make it transparent to the front end user. Have your form processing code save the page using whatever field you want for the title/name of the page, then $newpage->save(), then process the rest of the form fields including the file upload and then save again. Does that make sense? 1 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