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条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?