Uploading file in PHP returns nothing when file size is big -
<?php //max size of 2 mb define('max_file_size','2000000');//2 mb $allowed_file_types=array('image/jpg','image/png','image/jpeg'); //var_dump($_files['file_to_upload']); if($_server['request_method']=='post'){ if(isset($_post['action'])){ if($_post['action']=='upload_image'){ //if($_files['file_to_upload']['error']){ //} if(isset($_files['file_to_upload'])){ $file_arr=$_files['file_to_upload']; $check=false; echo $file_arr['type']; //for allowing image type foreach($allowed_file_types $type){ if($file_arr['type']==$type){ $check=true; } } if($check){ //checking size limit if($file_arr['size']>max_file_size){ echo "<p class='warning'>the file size above limit. optimize image , upload again.</br>your file size:".round(($file_arr['size']/1000000),2)."mb<br/>allowed file size: ".round((max_file_size/1000000),2)."mb</p>"; }else{ upload_form($file_arr); } }else{ echo "<p class='warning'>".$file_arr['type']." type of file not allowed upload</p>"; } } } } }
i using code information file uploading form. happens when select file greater 2.7/3 mb var_dump have used on $_files return null. working on other files less size. proper array $_files. may causing happen? suggestions?
btw php.ini max_upload_size==65m
Comments
Post a Comment