Can't upload file [CI4] |
Hello!
I'm trying to upload a file through a simple form, but when it gets to retrieve it on server side the corresponding parameter is empty. I tried to do the upload without using CI with a basic form and a basic server side script and it works, so maybe there's something wrong in CI... what could it be? I already checked field name, write permission on folder (which is the same I used with the basic script), form enctype.... everything! Any ideas or suggestions? (11-28-2023, 10:48 PM)kenjis Wrote: Try this: Thanks, I've already tried that code and the img variabile is null when it comes to call its methods. I found that the issue is that I'm making an asynchronous call to the controller that saves data, turning it to synchronous make it works. So now the question is: what has to be done to make it work with an ajax call? (11-29-2023, 08:48 AM)cellomar Wrote:(11-28-2023, 10:48 PM)kenjis Wrote: Try this: Here is js code I'm using Code: $("#myform input").each( function(indice, elem){ (11-29-2023, 08:48 AM)cellomar Wrote:(11-28-2023, 10:48 PM)kenjis Wrote: Try this: Mistery solved, there was an operation missing on js side to retrieve file content, here it is Code: let file_data = $('input[name="userfile"]')[0].files; |
Welcome Guest, Not a member yet? Register Sign In |