How to upload image without refresh page using Ajax and PHP

Are you looking for ajax file/image upload without refreshing page using ajax, Jquery and php. I had implemented this ajax form submitting using jquery.form plugin. You may also like How to Load Data From Database Without Page Refresh using Ajax, jQuery and PHP and How to Submit the Form Without Page Refresh using Ajax, jQuery and PHP.


<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"/>

jQuery Code

<script src=""></script>
<script src=""></script> 
    $(document).ready(function() { 
        $('form').ajaxForm(function() { 

PHP Code

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

Leave a Reply

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