I am using easyupload jquery
Src: https://github.com/fater/jquery-easyupload
I am trying to upload files ( images,doc,docx uploaded perfectly) but pdf showing me error but its not explaning the error.
My CODE:
elseif ($type == "upload_file") {
$target_dir = $_SERVER['DOCUMENT_ROOT']."/admin2/uploads/images/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
if (file_exists($target_file)) {$data['status'] = "error"; $data['msg'] = $BNL->msg("הקובץ עם השם הזה כבר קיים במערכת.");}
elseif ($_FILES["file"]["size"] > 5000000) {$data['status'] = "error"; $data['msg'] = $BNL->msg("המגבלה של העלאת קובץ היא 5MB");}
elseif($imageFileType != "pdf" && $imageFileType != "doc" && $imageFileType != "docx" ) {$data['status'] = "error"; $data['msg'] = $BNL->msg("הקבצים המותרים הם PDF, DOC, DOCX");}
else {
if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
$data['msg'] = $BNL->msg("הקובץ ". basename( $_FILES["file"]["name"]). " הועלה בהצלחה.", true);
$_SESSION['file'] = basename( $_FILES["file"]["name"]);
} else {
//$data['msg'] = $BNL->msg("סליחה, הייתה בעיה בהעלאת הקובץ.");
$data['msg'] = $_FILES['file']['error']; // Print "1"
}
}
echo json_encode($data);
}