Closed Mina-R-Meshriky closed 5 years ago
The input file is not transmit whit other fields, I have a same problem...
I will check :-)
//var data = form.serialize(); //==> comment this
var data = new FormData($(form).get(0)); //==> add this
var type = (options.ajaxFormValidationMethod) ? options.ajaxFormValidationMethod : "GET";
var url = (options.ajaxFormValidationURL) ? options.ajaxFormValidationURL : form.attr("action");
var dataType = (options.dataType) ? options.dataType : "json";
$.ajax({
type: type,
url: url,
cache: false,
dataType: dataType,
data: data,
form: form,
methods: methods,
options: options,
processData: false, //==> add this
contentType: false, //==> add this
[...]
});
I find a solution, I replace the serialized who not recognize the file input by the FormData. and Voila !
Great :+1:
I'm submitting a Question
Current behavior
I am trying to 'upload a file' with the form on the "onAjaxFormComplete" method, but it appears that it can't be read on the server side
$_FILES['passport_photo'] = null
is there a way to send the file to process some validations on it before actually storing it to the system.