ottogal Posted October 4, 2016 Share Posted October 4, 2016 Hi all, to upload a huge file I'm trying the workaround presented by Nico in his Troubleshooting Guide at the end of page 4. Running /tmp/uploadhelper.php I get the message Error: Call to a member function add() on a non-object (line 7 of ....../tmp/uploadhelper.php) where line 7 is $filepage->fieldname->add($config->paths->root.'tmp/hugefile.zip'); Of course fieldname is the name of a field I added to the template of the $filepage defined before. I tried to replace $filepage->fieldname with $filepage->get("fieldname"), to no avail. What do I have to do to change this into an object? Thankful for any hint... Link to comment Share on other sites More sharing options...
BitPoet Posted October 4, 2016 Share Posted October 4, 2016 Does your uploadhelper.php create a new page? If yes, it needs to be saved once before assigning to any file/image fields. If you assign to an existing page, make sure that you in fact retrieve the correct one (and not the NullPage instance returned when a $pages->get call finds no matching page). Link to comment Share on other sites More sharing options...
ottogal Posted October 5, 2016 Author Share Posted October 5, 2016 The filepage already exists. I used the code from Nico nearly literally. The explanation there is a bit short; so I'm not sure what Field Type the field should be. I tried URL or simple text for the filename, but these wouldn't give an object. Could it be Page Table? A Page Array - since a foreach is mentioned? A more detailed example would be helpful. Link to comment Share on other sites More sharing options...
BitPoet Posted October 5, 2016 Share Posted October 5, 2016 The field needs to be of type File (or Image if the added files are images to be used as such e.g. in CKEditor). 1 Link to comment Share on other sites More sharing options...
ottogal Posted October 5, 2016 Author Share Posted October 5, 2016 That's it (of course!)... (Although I'm quite sure to have tried type File too.) Thank you, BitPoet, for your time. 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