Page 1 of 1

nuBuilder functions not available

Posted: Thu Sep 05, 2024 12:43 pm
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.

Re: nuBuilder functions not available

Posted: Fri Sep 06, 2024 7:32 am
by kev1n
If you include that php file in nuconfig.php, you should be able to call core functions such as nuRunQuery() as well.

Re: nuBuilder functions not available

Posted: Fri May 23, 2025 1:10 pm
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.