Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

file upload in php through ajax

var formData = new FormData($("#YOUR_FORM_ID")[0]);
$.ajax({
    url: "upload.php",
    type: "POST",
    data : formData,
    processData: false,
    contentType: false,
    beforeSend: function() {

    },
    success: function(data){




    },
    error: function(xhr, ajaxOptions, thrownError) {
       console.log(thrownError + "
" + xhr.statusText + "
" + xhr.responseText);
    }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #file #upload #php #ajax
ADD COMMENT
Topic
Name
3+6 =