Apache
Apache

Reputation: 1806

how to submit form with enctype multipart/form-data in jquery

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

Upvotes: 2

Views: 12707

Answers (3)

Junior Mayhe
Junior Mayhe

Reputation: 16411

Here some interesting instructions by Ben Nadel.

Upvotes: 1

Alpesh
Alpesh

Reputation: 5405

Just check out the below plugin if it helps -

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

Upvotes: 1

Quentin
Quentin

Reputation: 943569

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.

Upvotes: 0

Related Questions