Jquery ile form yapıyorum fakat, type file olan input boş mu dolumu kontrol ettiremedim. yardımcı olursanız sevinirim.

functions.php de tüm post olan inputları kontrol edebiliyorum . 1 numaralı olanlar.

fakat 2 numaralı olan type file bunu kontrol edemiyorum . var mı yok mu diye .

Size zahmet





jQuery Kodları.

function i_submit() {

$("form#data").submit(function(event){

event.preventDefault();

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

$('#result').stop().html('
').fadeIn();

$.ajax({
url: "functions.php?cr=i_submit",
type: "POST",
data: formData,
dataType: "json",
async: false,
cache: false,
contentType: false,
processData: false,
success: function (reply) {

if (reply.error) {
$("#result").html(reply.error).fadeIn(1000);

} else if (reply.succes) {
$("#result").html(reply.succes).fadeIn(1000);

} else {

}
}
});
return false;
});
}


PHP Kodları

if (!empty($_POST)) {


if (trim($_POST['title'])=='' OR empty($_POST)) {
$array["error"] = '

Başlık boş olamaz

';
} else if (trim($_POST['price'])=='' OR empty($_POST)) {
$array["error"] = '

Fiyat alanı boş olamaz

';
} else if ($_FİLES['file'] == "") {
$array["error"] = '

Resim alanı boş bırakılamaz

';
} else {
$array["succes"] = '

Başarılı

';
}


echo json_encode($array);
}
break;


HTML input