How to Upload Image Without Page Refresh using Ajax,jQuery and PHP

In this tutorial I will show you how to upload image without page refresh using ajax jQuery and PHP. For this we will use jQuery form plugin. Ajax and Jqery have made life easier for us all. You may also like Multiple file upload in Codeigniter

PHP, jQuery, Ajax and HTML Code

    move_uploaded_file($_FILES["upload_file"]["tmp_name"], "$folder".$_FILES["upload_file"]["name"]);

    <script src=""></script>
    <script src=""></script> 
$(document).ready(function() { 
    $('form').ajaxForm(function() { 
        <form action="" method="post" enctype="multipart/form-data">
            <input type="file" id="upload_file" name="upload_file" />
            <input type="submit" name='submit_image' value="Upload Image"/>

Leave a Reply

Your email address will not be published. Required fields are marked *