JQuery

jQuery AJAX file upload PHP

Royan Chusain Azhari | 19 Feb 2021 | dilihat 3

Ajax Jquery Picture

File upload functionality is a common feature for the dynamic web application. Generally, a form is submitted and page is refreshed to upload file in PHP. But if you want to provide a better user interface, jQuery and Ajax can be used to upload file without page refresh. In our earlier tutorial, we have provided an easy way to upload file using jQuery and Ajax in PHP. In this tutorial, we will show you the simplest way to upload file or image with form data using jQuery, Ajax, and PHP.

The FormData object compiles a set of key/value pairs to send using XMLHttpRequest. Basically, FormData is used to send the form data same like submit() method. The files can also be sent using FormData by including a file <input> element in the HTML <form>.

The example code shows how to submit form data and upload file using FormData object and PHP. The following functionality will be implemented in the sample Ajax file upload script.

  • Submit file with other form data via jQuery Ajax.
  • Upload file to the server and insert form data into the database using PHP and MySQL.




Image placeholder

Royan Chusain Azhari

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here',


Hobby Saya : Belajar  Olahraga