excee dthe max-file-sizepanmax是什么牌子意思

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free.
I have a website hosted on a PC I have no access to. I have an upload form allowing people to upload mp3 files up to 30MB big. My server side script is done in PHP
Every time I try and upload a file, I receive an error claiming that the file exceeds the maximum size allowed, so I need to increase the size. My research on the web suggested changing the .htaccess file which I do not have access to, so that won't work. Others suggested that I should add a custom php.ini file to my root which did not work. Any other suggestions?
1,77042137
You need to set the value of upload_max_filesize and post_max_size in your php.ini :
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
After modifying php.ini file(s), you need to restart your HTTP server to use new configuration.
If you can't change your php.ini, you're out of luck.
You cannot change these values at run- uploads of file larger than the value specified in php.ini will have failed by the time execution reaches your call to ini_set.
109k13160208
You can change it via 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 40M
php_value post_max_size 42M
56k16115147
You can also use
(only for PHP version below 5.3):
ini_set('post_max_size', '64M');
ini_set('upload_max_filesize', '64M');
Like @acme said, in php 5.3 and above this settings are PHP_INI_PERDIR directives so they can't be set using ini_set. You can use user.ini instead.
5,04312051
I had the same problem and i created a .user.ini file and put it in the directory in which the upload script was located. Than inside that file i set these these two values:
upload_max_filesize = 40M
post_max_size = 40M
and it worked great for me!
6,57061642
To locate the ini file, first run
php -r "phpinfo();
" | grep -i "loaded configuration file"
Then open the file and change
upload_max_filesize = 2M
post_max_size = 2M
replacing the 2M with the size you want, for instance 100M.
I've got a blog post about with a little more info too
I have the same problem in the past .. and i fixed it through .htaccess file
When you make change on php configration through .htaccess you should put configrations in
IfModule tag, other that the Internal server error will rise
This is example, it work fine for me
&IfModule mod_php5.c&
php_value upload_max_filesize 40M
php_value post_max_size 40M
&/IfModule&
And this is php referance if you want to understand more.
Non of those solutions work for me!! (already set to 32M by default).The problem is in most case max_allowed_packet
I am working on localhost and using MAMP.
1. If you don't have my.ini
--max_allowed_packet=
...\MAMP\bin\startMysql.sh
If you have my.ini
max_allowed_packet=100M
for me it works with the htaccess file as @Andrew Moore suggested. But most shared hosting companies does not allow >16mb upload size. This sucks. For >X mb upload size you need to consider using chunked solutions like plupload. Check out this example with full code on how to implement an .
protected by ♦
Thank you for your interest in this question.
Because it has attracted low-quality answers, posting an answer now requires 10
on this site.
Would you like to answer one of these
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabledHTML - Upload Forms
Upload fields provide the interface that allows users to select a local file and upload it to the web server. An upload field renders as two parts -- an empty text field and a Browse button that opens up a local window explorer on the user's computer. This allows them to quickly browse to the local file and automatically fills in the file path inside of the text field.
Setting the type attribute of the &input& to "file" places the upload element on a web page.
HTML Upload Field Code:
&form name="myWebForm" action="mailto:" method="post"&
&input type="file" name="uploadField" /&
HTML Upload Field:
HTML - Max File Size Field
File transferring across the internet is a complicated process and should include many layers of security.
HTML alone cannot ensure safe and secure file transferring, but it can offer a first line of defense. Using a MAX_FILE_SIZE hidden field can limit the size of files that are transferred.
Placing a restraint on an HTML upload field is accomplished by using a hidden input field with the name attribute set to MAX_FILE_SIZE.
HTML MAX_FILE_SIZE Code:
&form name="myWebForm" action="mailto:" method="post"&
&input type="hidden" name="MAX_FILE_SIZE" value="500" /&
&input type="file" name="uploadField" /&
HTML MAX_FILE_SIZE:
The value attribute specifies the maximum allowable kilobytes (KB) for any file selected by the user.
Found Something Wrong in this Lesson? - Your input is what keeps Tizag improving with time!
Web Reference
Help Tizag Grow
More Tutorials!Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free.
I was going through number of pages in google and pretty much all answers associated with this in stackoverflow, bus still, can not get this thing working.
I can upload smaller then 2M files, but not any larger.
I am running Centos 6.2 with PHP-FPM (PHP 5.3.10) and NGINX (nginx version: nginx/1.0.12).
Now I got client_max_body_size 10M; in nginx.conf, in the http section.
I also got upload_max_filesize = 8M , post_max_size = 8M , memory_limit = 128M
usually in almost any answer to this question I have met, these changes helps for users.
Now I done some research, and made this script:
//ini_set('upload_max_filesize', '8M');
$max_upload
= (ini_get('upload_max_filesize'));
= (ini_get('post_max_size'));
$memory_limit = (int) (ini_get('memory_limit'));
echo ('$max_upload ' . $max_upload);
echo ('$max_post ' . $max_post);
echo ('$memory_limit ' . $memory_limit);
Now If I run in in server terminal - i get $max_upload 8M $max_post 8M $memory_limit 128
But if I run it via webserver (NGINX) - I get $max_upload 2M $max_post 8M $memory_limit 128
So my assumption is that its NGINXes problem, but yet again the only NGINX parameter regarding this matter is client_max_body_size 10M; , which is sec correctly and is placed in the right place in the config.
I am sorry if this is something obvious, or if there is something I have missed, would be glad if someone would point me to the right direction.
So we solved it with AlexeyKa's help. We looked up in phpinfo, and there it said that php was using different php.ini file. Some time ago I made a copy of php.ini into my home directory. And it turnes out that when (some time ago) I restarted php-fpm, it switched from /etc/php.ini file to /home/my-user/php.ini file. Essentially I renamed the /home/my-user/php.ini and restarted the php-fpm. This solved everything, as it switched to /etc/php.ini. I will try to this behavior further, and will update the post, just in case someone will have the same problem.
user212218
May be different php.ini used? One for php-cli and another for php-fpm?
/etc/php5/fpm/php-fpm.conf
/etc/php5/cli/php.ini to be safe
and change where it has
upload_max_filesize = 2M
to whatever file size u want example
upload_max_filesize = 8M
then reload
/etc/init.d/php5-fpm restart
/etc/init.d/nginx reload
/etc/init.d/nginx restart
5,32561734
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled}

我要回帖

更多关于 exceedance 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信