Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

nuBuilder functions not available Topic is solved

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
vario
Posts: 148
Joined: Mon Dec 05, 2011 12:23 pm
Location: Newton Abbot, UK
Has thanked: 1 time
Been thanked: 1 time

nuBuilder functions not available

Unread post by vario »

I am experimenting with the file upload code at edit_upload_file but finding I get "call to undefined function" when I try to use nuRunQuery() in upload.php.

I am uploading from a launch form rather than an edit form so have removed record_id-related code, but it all works except for nuRunQuery.

How can I use the nuBuilder functions in this scenario?

Neil.
kev1n
nuBuilder Team
Posts: 4291
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: nuBuilder functions not available

Unread post by kev1n »

If you include that php file in nuconfig.php, you should be able to call core functions such as nuRunQuery() as well.
vario
Posts: 148
Joined: Mon Dec 05, 2011 12:23 pm
Location: Newton Abbot, UK
Has thanked: 1 time
Been thanked: 1 time

Re: nuBuilder functions not available

Unread post by vario »

I need to re-open this one...

When including the file upload code via $nuConfigIncludePHP I get two PHP warnings, and I cannot login to the database - I get an "Uncaught" error with a screen full of overlaid text.

Code: Select all

PHP Warning:  Undefined array key "file" in /var/www/forte/libs/upload_payin.php on line 13, referer: https://myserver.co.uk/forte/index.php
PHP Warning:  Trying to access array offset on null in /var/www/forte/libs/upload_payin.php on line 13, referer: https://myserver.co.uk/forte/index.php
This is the code causing the error

Code: Select all

 if (!isset($_FILES['file']) || !is_uploaded_file($_FILES['file']['tmp_name']) || $_FILES['file']['error'] != UPLOAD_ERR_OK) {
  throw new Exception($_FILES['file']['error']);
 }
Is there a way round this? I thought perhaps if could have the file upload code on the server to just move the file to its destination, then somehow use nuRunPHPHidden to do the database processing using nuRunQuery?

Neil.
Post Reply