views:

83

answers:

2

hi expert, i'm using form with enctype multipart/form-data for uploading photo, so below is my code for normal form submit,

$.ajax({  
    type: "POST",  
    url: loadUrl,  
    cache: false,  
    success: function(html){  
      $(outputLocation).html(html);  
    }
});    

how this should alter, so its applicable for multipart/form-data type form in jquery

thanks in advance

A: 

You can't submit files over XMLHttpRequest (since you can't read the data from the user's HDD in JS).

jQuery doesn't have built in support to deal with file inputs, you'll need to find a plugin or an alternative.

David Dorward
+1  A: 

Just check out the below plugin if it helps -

http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Overview

Alpesh