Jump to content

Recommended Posts

Posted

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

 

Posted

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

Posted

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.

Posted

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

  • Like 1
Posted

That's it (of course!)...  (Although I'm quite sure to have tried type File too.)

Thank you, BitPoet, for your time.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...