dpklt4291 2018-08-09 11:10
浏览 339
已采纳

jquery easyupload插件不上传pdf文件

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);
        } 

I cant figure it out what the problem I am trying to fix it for two days.

Any one can help me please, thanks in advance.

</div>
  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?