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?

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

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题