File upload form

Hi guys,
I’m trying to create a form with file upload. But I just can’t get it to work.
I created a temp folder in the project directory. I changed the upload_tmp_dir in php.ini to this folder and also in the server connect settings. But the file doesn’t even upload to the temp directory let alone get moved to my sought directory.
Have the php.ini settings of my lampp server anything to do with the server connect settings? Is there something I am missing?
The type of the post variable is set to “File”. In php.ini: “file_uploads=On”.

hi @jowhiskey
Please check the error returned by the server, as explained here: Debugging Problems

1 Like

Thanks for this link, I tried debugging before but I didn’t know where to look.
So in Network - XHR no error messages are being displayed. I checked everything but no hints so far.
What got me a bit curious is a source-map error in the console tab.
It throws a 404 on the file dmxAppConnect.js.
So I checked out this file and I recognized, there is some sort of correlation with file uploads regarding the file type.
So is it a possibility that the server can’t find dmxAppConnect.js which means the file cannot be identified?

Error 404 means the dmxAppConnect.js cannot be found, which means that most probably it’s no uploaded to your server.
Without the dmxAppConnect.js the form cannot be submitted and file upload won’t be executed. Please make sure to manually upload all the files to your remote target.

1 Like

I reloaded the page itself and it throws me a 404 on each .js file. So I’m pretty confident that this has to do something with my xampp server and not with the webpage itself. So I’m gonna dig deeper into that and let you know what I achieved (Provided that I’ve achieved anything :sweat_smile:)

If all the js files are showing 404 errors - check if they are uploaded to the selected target.

1 Like

Ah forgot to mention! that was no problem. Files are all there on the local server.
What I don’t understand, everything else works fine. I can perform all sql commands, the websites works like a charm except file upload.

Please provide a link to your page, where i can check this.

Right now I’m on a local server. And if I sent you my console output it wouldn’t help that much because it is german.
So right now I know that there is no bug or false option in wappler, about that I’m pretty sure.
As for the source mapping errors for the .js files, I’m gonna dig in a little deeper and see if I can fix this on my own. This way, I can learn a thing or two about what I don’t understand right now.
Thank you for your time so far!

Ah so it is not the actuall js files but the source map files?
If that is the case this is not an error and you should ignore these warnings - source map files are only used for our own debugging purposes and are not needed for the components to work.

The error must be somewhere else. Do you see anything in the NET>XHR tab when you submit your form?

1 Like

Ah that is good to know! I’ve researched a bit about these source map errors and I wasn’t sure if these are root of this problem. And I coudn’t quite understand what they are for until now. I hadn’t to do anything with javascript before except small snippets like sticky headers etc.

NET>XHR doesn’t show any error at all.

Maybe I’m missing something crucial. I did everything according to this tutorial:

I created a server connect form with a file upload and imported all post variables into the server action including the file variable with the type “file”. I set a temp folder that is placed inside the project folder. In the file upload I set the upload fields to the file variable and specified an upload path which is also placed in the project folder.
It looks like the file doesn’t even get moved or even recognized.

The column “Übertragen” (which means transmitted) should at least show the file size right?

Well i see your server action returns a status of 200 (OK) if that is what runs when you submit the form: uploadrecord.php so no errors are returned from the server.

Can you enable all the “OUTPUT” options in any server connect steps you see and save the action file, then run it again and when it runs just select it in the NET>XHR and see the response.

1 Like

Aaaah now I have something! Output did nothing but then I checked “Throw errors” and now I have my response.
It’s a 500 error and I already now what’s going on. It’s a matter of permissions. The command move_uploaded_file has none.
The blame is all on lampp and on me! I already had problems with permissions in lampp in the past but back then I had the output directly on the page because I coded with plain php. On a real server, such permission troubles wouldn’t exist.
Thank you for leading me on the right path without you I still would be crawling through the web to understand source map files :joy:

1 Like

Ok I changed permissions of the temp and the destination folder and upload works like a charm!
So in case anyone is using local servers, check your permissions on the folders. On linux, chmod 777 does the job since system and user have read, write and execute. I would recommend to apply this commands only to specific subfolders and not to the entire root folder of the server otherwise you run in danger to completely corrupt your file system. Been there, done that!

1 Like