首页 文章

Codeigniter上传PDF - CI版本2.1.4

提问于
浏览
0

我有一个运行2.1.4的CI项目,我正在尝试上传.pdf文件 .

我知道这个问题在其他地方被问到,但我没有看到任何人确定以下细节和尝试更正只是为了解决问题 .

主要目标:通过codeigniter do_upload功能添加上传pdf文件的功能

在其他地方搜索解决方案后,我试图更新我的mime.config文件但没有成功 .

var_dump($ this-> upload-> data())提供以下输出:

array(14){[“file_name”] => string(14)“AL14052701.pdf”[“file_type”] => string(15)“application / pdf”[“file_path”] => string(31)“ / var / www / Inspection / Attachment /“[”full_path“] => string(45)”/ var / www.lnspection/Attachment/AL14052701.pdf“[”raw_name“] => string(10)”AL14052701“[ “orig_name”] => string(0)“”[“client_name”] => string(14)“AL14052701.pdf”[“file_ext”] => string(4)“ . pdf”[“file_size”] => float(313.54)[“is_image”] => bool(false)[“image_width”] => string(0)“”[“image_height”] => string(0)“”[“image_type”] => string( 0)“”[“image_size_str”] => string(0)“”}

然后,我检查了我的mimes.php文件,并确认类型pdf包含“application_ pdf”类型,如“file_type”变量中所示 . . . 它做了:

'pdf'=> array('application / pdf','application / x-download'),

控制器中允许的类型:

$ config ['allowed_types'] ='zip | doc | docx | xls | xlsx | ppt | pptx | csv | ods | odt | odp | pdf | rtf | txt | avi | mpeg | mp3 | mp4 | 3gp | gif | JPG | JPEG | PNG';

php版本

5.3.2-1

我有一个类似的问题,上传ods和odt文件,但能够通过mimes.php文件解决这个问题 . 我也查看了我的Upload.php

我可以在不使用codeigniter时将pdf文件上传到同一台服务器,并且能够上传其他文件类型(.doc,.xls,.odt,.ods,.txt是我尝试过的类型) . 我错过了什么?

1 回答

  • 0

    令人难以置信......有时候你无法通过树木看到森林......问题是文件大小,而不是文件类型 .

相关问题