所以我试图上传大于1Mb的文件使用Php,但他们上传到我的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,所以需要多一个0…
<input type="hidden" name="MAX_FILE_SIZE" value="20000000">
这个修复了它!现在是20Mb…