cannot change php upload size limit

别说谁变了你拦得住时间么 提交于 2019-12-06 15:54:09

问题


I used uplaodify plugin to upload music files. Everyting is okay in my local

uploadify.php file is in public_html/uploadify directory

i want to increment my upload file size limit to 10 MB

i tried to put

php.ini file in public_html

post_max_size = 500M
upload_max_filesize = 500M
max_execution_time = 900;
max_input_time 900

and I am looking my phpinfo() thats good but ı cannot upload bigger than 2MB

And i tried to put same php.ini in public_html/uploadify

Now I can upload file which size 2.5 MB , but no upper;

And

ini_set('upload_max_size','10M');
ini_set('post_max_size','10M');
ini_set('max_execution_time','900');

lines is in the my index.php and uploadify.php

What should I do increment my file upload size limit

EDIT

I look $_FILES[..]['error'], and its 7

UPLOAD_ERR_CANT_WRITE

    Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.

But I can upload file which smaller than 2.5 MB


回答1:


Edit the .htaccess file in the root folder and add these values:

RewriteEngine On
php_value post_max_size 1000M
php_value upload_max_filesize 1000M
php_value max_execution_time 6000000

You can edit it to suit your needs. 1000M = 1GB, so edit accordingly. Do note that your host will need to allow PHP edits.




回答2:


You cannot override upload limits from within a script using ini_set - the upload will have completed (or been aborted) using the original settings long before PHP fires up and processes the ini_sets.

You can't just litter php.ini files around your system either - php doesn't load random .ini files it finds lying around. It only loads them from specific locations. If PHP hasn't been told to load one from the uploadify directory, you'll have to use a .htaccess and php_value directives.




回答3:


Hello I had the similar issue while uploading a theme on wordpress on localhost. After hours of research I was able to put following 3 lines in my php.ini and restarted the apache and it worked. I thought this will help others.

This will go in file upload section of ini

upload_max_filesize = 800M

post_max_size = 800M

max_file_uploads = 800M



来源:https://stackoverflow.com/questions/6999439/cannot-change-php-upload-size-limit

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