繁体   English   中英

无法在Hostgator中上传大于1Mb的文件

[英]Unable to upload files larger than 1Mb or so in Hostgator

因此,我尝试使用Php上传大于1Mb的文件,但它们以空文件的形式上传到我的MySQL数据库中...我检查了php.ini文件,其限制为64Mb。 如果文件小于1Mb,则文件将被上传到数据库,并且还保存在临时文件夹中...

     post_max_size  64M 64M
     upload_max_filesize    64M 64M

我在Hostgator托管上,相关网站是www.takebooks.in。 我与支持团队进行了交谈,他们说一切都很好,问题出在我的代码上……我不认为这与我的php代码有关……我认为唯一可能会影响的是(这是精细):

      <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
      Photo: <input type="file" name="photo" required="required"><br> 

在我的数据库中,文件的数据类型为mediumblob,大约允许16Mb。 我很困惑,问题出在哪里? 当我尝试上传文件时出现此错误日志...

[14-Jul-2014 01:08:50] PHP Warning:  fopen() [<a href='function.fopen'>function.fopen</a>]: Filename cannot be empty in /home/basicssc/public_html/takebooks.in/listitem.php on line 34
[14-Jul-2014 01:08:50] PHP Warning:  fread(): supplied argument is not a valid stream resource in /home/basicssc/public_html/takebooks.in/listitem.php on line 35
[14-Jul-2014 01:08:50] PHP Warning:  fclose(): supplied argument is not a valid stream resource in /home/basicssc/public_html/takebooks.in/listitem.php on line 37
[14-Jul-2014 01:08:50] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/basicssc/public_html/takebooks.in/listitem.php:34) in /home/basicssc/publi

天哪,这是一个愚蠢的错误,因为您可以在我的html中看到最大文件限制为

 <input type="hidden" name="MAX_FILE_SIZE" value="2000000">

这是大约2MB,因此需要再添加一个零...

 <input type="hidden" name="MAX_FILE_SIZE" value="20000000">

这个解决了! 现在它的20Mb ...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM