Large file uploads failing php

我只是一个虾纸丫 提交于 2019-12-20 04:57:28

问题


I've made a tiny site where my friends can upload songs and some tiny files that they want to but my problem is that files over 5mb fails, as in the browser shows "Connection reset" error.

The max file size set by my server is 2Mb, but i can upload 2.5-3Mb fine
Probably because i overwrote it with .htaccess

But however file uploads over 5Mb they just don't get uploaded at all, as i said earlier browser cannot reach server.

Would this be a server issue? Or an issue in my code? Will i need to change things in order for large uploads to happen?
Also max post size and max file size is set to 40mb in the .htaccess file

Here is the website http://sharebay.webatu.com/

You can try uploading some files over 7mb, mp3/flac/aac/m4a/wav/


回答1:


Add these to .htaccess as well (adjust 10M to size in MB that you want):

php_value upload_max_filesize 10M
php_value post_max_size 10M

This assumes you don't have access to php.ini (otherwise it would be better to put there) and that your host does not prohibit htaccess overrides on these values.

If you've already tried that then post more info about your environment. If you are on a shared server it's probably not something you can change too much.




回答2:


How long the upload takes?

If you have slow upload line then it should take more time then max_execution_time and then apache halts your PHP script.




回答3:


Change file upload size

You can change it an .htaccess file.

.htaccess files are stored in the same directory as your .php files are. They modify configuration for that folder and all sub-folders. You simply use them by creating an .htaccess file in the directory of your choice (or modify it if present).

The following should enable you to increase your upload limit (if the server provider allows PHP config changes via .htaccess).

php_value upload_max_filesize 70M
php_value post_max_size 80M
php_value memory_limit 90M
php_value max_execution_time 240
php_value max_input_time 240 

you can change size according ur need



来源:https://stackoverflow.com/questions/9921224/large-file-uploads-failing-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!