doutan5724 2014-11-03 02:07
浏览 35
已采纳

如何通过phplocalmyadmin将2+ MB文件上传到xampp MySQL?

I'm creating a database and was trying to upload my images into it. However, I encounter a sql server run away error when i tried to upload a 2+MB file.

When I upload a 4MB file, the page simply resets

When i upload a 30+kb file, it works !

I have created the column (longblob) and change the upload_max_file size limit in php.ini to 64MB.

The error is shown in this picture

  • 写回答

1条回答 默认 最新

  • dousong2967 2014-11-03 03:22
    关注

    You have to consider more things to do this job.

    1. 'max_allowed_packet'

      mysql> show variables like 'max_allowed_packet';

    2. Your Column type. MySQL Documentation

      TINYBLOB

      L+1 bytes, where L < 28 ± 256 bytes BLOB

      L+2 bytes, where L < 216 ± 65 kilobytes MEDIUMBLOB

      L+3 bytes, where L < 224 ± 16 megabytes LONGBLOB

      L+4 bytes, where L < 232 ± 4 gigabytes

    3. The better and faster way is store/upload your image/file into disk storage, not db storage. And just store the file location into db.

    And read these link: How can I insert large files in MySQL db using PHP?

    MySQL - Uploading Image To BLOB Max Upload Size?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 酬劳2w元求合作写文章
  • ¥15 在现有系统基础上增加功能
  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 关于#java#的问题:找一份能快速看完mooc视频的代码
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图