上传pdf文件到Mysql服务器
我无法上传使用 Photoshop 和 PDFTK 创建的 pdf 文档。其他pdf文档上传没有任何问题。
我收到以下警告:
中的有效流资源
fread()
:提供的参数不是警告:
fclose()
:提供的参数 不是有效的流资源
I am unable to upload the pdf documents that are created using Photoshop and PDFTK. Other pdf documents are getting uploaded without any problem.
I am getting the following warning:
fread()
: supplied argument is not a
valid stream resource inWarning:
fclose()
: supplied argument
is not a valid stream resource
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不建议将 PDF 上传到 MySQL - 您必须将其保存为 BLOB,然后读取 BLOB。这将使您的数据库迅速膨胀并导致速度问题。
相反,请将 PDF 上传到文件系统,并将 PDF 的路径保存在 MySQL 中。然后你可以从 MySQL 读取该路径。
但是,如果您绝对需要将文件保存为 BLOB - 这里有一个很好的教程:
http://bytes.com/topic /php/insights/740327-uploading-files-into-mysql-database-using-php
I wouldn't suggest uploading the PDFs to MySQL - you would have to save it as a BLOB, and then read the BLOB. This will bloat your database quickly and cause speed issues.
Instead, upload the PDF to the file system, and save the PATH to the PDF in MySQL. Then you can read that path from MySQL.
However, if you absolutely need to save the file as a BLOB - here is a good tutorial for doing so:
http://bytes.com/topic/php/insights/740327-uploading-files-into-mysql-database-using-php