file upload over 2mb

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
User avatar
lazerbri
Forum Newbie
Posts: 15
Joined: Sat Dec 27, 2003 8:17 am

file upload over 2mb

Post by lazerbri »

hi is there a upload limmit when uploading a file using php to a dir

Code: Select all

<?php
#-----------------MAKE DIR-----------------------------------------

if ($TheFile != "") {
copy ("$TheFile", $DOCUMENT_ROOT."/folder/$TheFile_name") or die("Could not copy file");
}else { 
exit(); 
}
chmod("/$dir/$TheFile_name", 0755); 

?>
it will look like its working but any files over 2mb will not upload

can you help

thanks

Brian
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post by Bill H »

There ia a constant MAX_FILE_SIZE that defaults to 2Mb.
You can reset it in your form:

Code: Select all

<input type="hidden" name="MAX_FILE_SIZE" value="200000">
Use whatever size you wish, but your host may have parameter limits.
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post by MarK (CZ) »

There's also 'upload_max_filesize' var in php.ini.
You should check the filesize yourself with php because HTML can be changed by user, of course.
User avatar
lazerbri
Forum Newbie
Posts: 15
Joined: Sat Dec 27, 2003 8:17 am

thanks now I no what the prob is thanks again

Post by lazerbri »

upload_max_filesize 2M you was right

thanks now I no what the prob is thanks again
PanK
Forum Commoner
Posts: 36
Joined: Mon Nov 22, 2004 1:24 pm
Location: Richmond Hill, ON, Canada

Post by PanK »

run <? phpinfo(); ?> it will tell the size.
Post Reply