Welcome to the nuBuilder Forums!

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

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

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
Costa
Posts: 39
Joined: Sun Aug 15, 2021 9:46 am
Has thanked: 11 times
Been thanked: 4 times

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

Unread post 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
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

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

Unread post 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.
If you like nuBuilder, please leave a review on SourceForge
Costa
Posts: 39
Joined: Sun Aug 15, 2021 9:46 am
Has thanked: 11 times
Been thanked: 4 times

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

Unread post 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
Costa
Posts: 39
Joined: Sun Aug 15, 2021 9:46 am
Has thanked: 11 times
Been thanked: 4 times

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

Unread post 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
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

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

Unread post 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
If you like nuBuilder, please leave a review on SourceForge
Post Reply