user3731557 user3731557 - 4 months ago 55
PHP Question

ajax multipart/form-data post charset utf-8

i have a form with upload file and input text that requires an utf-8 encoding, when i try to send the form trough ajax i can't change the contentType: false so how can i protect my text as well!?

url : 'url';?>',
type: "POST",
data: new FormData(this),
contentType: false,
cache: false,
success: function(data)

alert 'ok';



You can use this code on form submit:


    var formData = new FormData($(this)[0]);

        url: 'your_url',
        type: 'POST',
        data: formData,
        async: false,
        success: function (data) {
        cache: false,
        contentType: false,
        processData: false

    return false;