Page 1 of 1

Upload error using "Subform: Uploading a File on button click"

Posted: Mon Nov 13, 2023 3:15 pm
by Costa
Hello everyone,

having the need to implement the upload of multiple files connected to the same id of the main form, I decided to implement what is described in the NUBuilder 4.5 code library using a subform. The only difference is that I changed the destination directory where to place the files and therefore I consequently modified both the upload.php file and the others two code files with the new directory which is located in the main directory and therefore /home/upload/documents/

There is no way to make it work, i get the "upload failed" error and the server reports in the log "Warning: Undefined array key 11 in /home/nubuilder/core/nuform.php on line 999"

I set all the directory permissions to 0775, i double checked all db tables but no results therefore I decided to clone the example shown in the code library but the error always remains the same.

It's definitely one of those silly mistakes that you have just in front your eyes and you don't see it, which is why I'm asking your help.

Thanks for any suggestions

Re: Upload error using "Subform: Uploading a File on button click"

Posted: Mon Nov 13, 2023 6:16 pm
by Janusz
At least from system side you can check if nuBuilder can access the folder. So one simple check can be:
Created php procedure ex.:

code: test
Description: test
Run: hidden

PHP:

Code: Select all

$path  = '/home/upload/documents/';
$file = $path.'/mytest.txt';
file_put_contents($file, "test test test");
$files = scandir($path);
nuDebug($files);
Run from browser console (F12)

Code: Select all

nuRunPHPHidden('test')
After that check the nuDebug results: CTRL+SHIFT+D
if the files from the /home/upload/documents/ are listed including mytest.txt then at least from system side you can access the folder.

Re: Upload error using "Subform: Uploading a File on button click"

Posted: Tue Nov 14, 2023 8:50 am
by Costa
Thanks Janusz,

i will check it in a couple of days (now travelling for work) and i will be back.

Thanks for supporting

Re: Upload error using "Subform: Uploading a File on button click"

Posted: Sun Nov 19, 2023 1:30 pm
by Costa
Hi Janusz,

sorry for my late replay but two days travelling at the end were a week!

Thanks to your procedure i found out that i had to write the full directory which is:
/web/htdocs/www.xxxx.it/home/upload/documents/

and now i can have the file mytest.txt written in the right directory and all files are listed using the procedure, no errors in the nudebug but still error on apache side, infact the reported error is :

19/11/2023 13:27:51 [error] - www.xxxx.it - AH00687: Negotiation: discovered file(s) matching request: /web/htdocs/www.xxxx.it/home/web (None could be negotiated)., referer https://www.xxxx.it/nubuilder/index.php
19/11/2023 13:27:43 WARNING: [pool www.xxxx.it] child 620 said into stderr: "[19-Nov-2023 13:27:43 Europe/Rome] PHP Warning: Undefined array key 11 in /web/htdocs/www.xxxx.it/home/nubuildern/core/nuform.php on line 999"

What drive me nuts is that nowere i used the directory /web/htdocs/www.xxxx.it/home/web stated in the second apache error and using your procedure no errors.
I'm not a professional programmer and i do not know how to put my hands therefore any suggestions is more than welcome.

Thanks

Re: Upload error using "Subform: Uploading a File on button click"

Posted: Sun Nov 19, 2023 2:28 pm
by Janusz
Hi, looks like some settings on the apache side. Myself I did not experience similar issues on Debian. I saw some disscussion on that but can not help much here.
https://serverfault.com/questions/372733/apache-file-negotiation-failed
https://www.apachelounge.com/viewtopic.php?p=42159
https://serverfault.com/questions/548521/getting-negotiation-discovered-files-matching-request-error-not-sure-why