error in upload large file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simran10101
Forum Newbie
Posts: 3
Joined: Sat Aug 07, 2010 3:10 am

error in upload large file

Post by simran10101 »

if user is uploading a large file from our website ( form ) then a user who uploads larger file will get no error and still the form will be processed only without the file.[this code is work ok till 10MB] but more than 10mb it is not working. Can any body tell me the solution of this pbm.
Thanks in Adv
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: error in upload large file

Post by pbs »

Check "upload_max_filesize" in PHP.INI file
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: error in upload large file

Post by cpetercarter »

As pbs has indicated, your php installation will have a limit to the size of file which it will upload. You can check what the limit is with the following:

Code: Select all

$echo "Maximum upload limit is " . ini_get('upload_max_filesize');
Often it is as low as 2Mb.
Annoyingly, you don't generally get an error message when an upload fails because a file is too large - the upload just fails silently.

What to do? You can of course change the setting in php.ini, but most users do not have access to the php.ini file, nor can they restart Apache (which is needed for the new setting to have effect). It is sometimes possible to increase the maximum size of an uploaded file in an .htaccess file:

Code: Select all

php_value upload_max_filesize 10M
But Apache is sometimes set up to reject attempts to rewrite php values in .htaccess files - worse, you get "Internal Server Errors" until you remove the offending line from the .htaccess file.

Which leaves you with :

using a perl/cgi script to upload large files, if your server admin allows this.

ftp - ftp servers can upload large files, but you will need to think carefully through the security implications of letting users access your site via ftp.
Post Reply