image upload in PHP
I can uplo开发者_如何学编程ad small size files with no problem,
but fail when the size is more than 1M.
What's the matter?
You probably need to configure the upload_max_filesize
directive, in your php.ini
file : PHP will not accept an upload of a file that is bigger than what this directive defines.
And note that you might also need to adjust post_max_size
-- which defines the total size of data that can be POSTed (And files upload are sent via POST).
You can also take a look at the Handling file uploads section of the manual, which can give you a couple of useful informations about files upload.
Are you sure you have upload_max_filesize set correctly in php.ini?
Edit you php.ini file to allow for larger uploads.
HERE's some info
You can call echo phpinfo() and then verify your upload_max_filesize and other php environment settings. Its very possible that your script is dying because one of the max limits is being exceeded.
Depending on your environment you can either use ini_set() to change the necessary values at run-time or you can simply edit your php.ini file to set the value permanently. Please note that not all php.ini settings can be changed at run time and if you do edit php.ini, you will need to restart Apache.
As said by others check your php.in for upload_max_filesize
and post_max_size
settings. If they are okay and if you are using a 3rd party script for uploading, make sure the script is not limiting the max file size by doing something like:
if( $_FILES["file"]["size"] > (1024 * 1024) ) // disallow uploads > 1MB
{
// max size exceeded.
}
精彩评论