Page 4 of 6
Re: upload file to server
Posted: Tue Nov 19, 2019 8:53 am
by johan
Kev1n
This is my result
Re: upload file to server
Posted: Tue Nov 19, 2019 9:08 am
by kev1n
Add
in this code (input_type_file.htm) and open the developer console (F12).
debugger.png
Then upload the file and press F10 when the debugger stops to jump to the next row and to investigate the variables.
Video:
https://streamable.com/x1y19
result.error should be empty if the upload was successful.
Re: upload file to server
Posted: Tue Nov 19, 2019 2:53 pm
by johan
Kev1n
I get this error
Code: Select all
<this>: {…}
arguments: Arguments
data: "{\"status\":\"error\",\"error\":\"ERROR_MOVING_FILE\"}"
err: undefined
result: undefined
data: "{\"status\":\"error\",\"error\":\"ERROR_MOVING_FILE\"}"
err: "The file cannot be moved to the destination directory."
result: {…}
I don't understand why it's not possible to move the file to my server.
Re: upload file to server
Posted: Tue Nov 19, 2019 3:02 pm
by kev1n
What value does $uploaddir (Upload directory) have in your upload.php?
Re: upload file to server
Posted: Tue Nov 19, 2019 3:08 pm
by kev1n
You could also try setting the variable to "document root" / nuBuilder root dir (and create there a documents folder)
$uploaddir = $_SERVER['DOCUMENT_ROOT']."/documents/";
Re: upload file to server
Posted: Wed Nov 20, 2019 7:48 am
by johan
Kev1n
changed $uploaddir = './documents/' to $uploaddir = './documents' and now the upload works.
But my file is saved in folder upload not in folder documents.
When I try to reopen the file it points to the wrong url (in documents)
Johan
Re: upload file to server
Posted: Wed Nov 20, 2019 8:16 am
by kev1n
Use the latest upload.php file
https://github.com/smalos/nubuilder-cod ... upload.php
and try setting the upload directory to
Code: Select all
$uploaddir = $_SERVER['DOCUMENT_ROOT']."/libs/upload/documents/";
Re: upload file to server
Posted: Thu Nov 21, 2019 10:14 am
by johan
Kev1n
With the new script it works fine. Thanks for your help.
Just 1 suggestion?
Is it possible to remove the file from the server when deleted in Nubuilder?
Johan
Re: upload file to server
Posted: Thu Nov 21, 2019 10:52 am
by kev1n
How do you want to delete the File in nuBuilder? On a button click?
Re: upload file to server
Posted: Thu Nov 21, 2019 1:37 pm
by johan
Kev1n
Just when I delete a subrow containing a file.
Than the row is deleted in de sql table.
Johan