Upload a file with ajax in cakephp 4.4

Is there a way to upload a file with ajax so that it stays in the same page and doesn’t reload it?


Oh, you wanted to know how? There’s lots of packages out there that do this for you. Look at uppy for example.

Thank you @Zuluru, what I need is to upload files to a folder in my web server, is this package able to do that?

Not all by itself, no. It’s JavaScript, so it runs on the browser, and the browser has no direct access to your web server folders. Take a look at it, if it’s not suitable for your needs just google other JavaScript file upload libraries.