It's working but on every submit I receive an array even tho a file is not even added to the file input (multifile input)
postData = new FormData(this);
$.ajax({
url: "/url",
type: "POST",
data: postData,
cache: false,
contentType: false,
processData: false,
success: function (data, textStatus, jqXHR) {
if (data === "true") {
window.location.replace("/url");
} else {
$(".errors").html(data);
}
},
error: function (jqXHR, textStatus, errorThrown) {
swal("Der opstod en fejl");
}
});
What i get from $_FILES is the following
Array
(
[files] => Array
(
[name] => Array
(
[0] =>
)
[type] => Array
(
[0] =>
)
[tmp_name] => Array
(
[0] =>
)
[error] => Array
(
[0] => 4
)
[size] => Array
(
[0] => 0
)
)
)
Is there a way where I can avoid this from happening?
this.4-UPLOAD_ERR_NO_FILE