ponies3387 Posted February 8, 2008 Share Posted February 8, 2008 Im having issues allowing a larger upload file size. I would like to allow 5mbs, the script below allows 2mb right? So ive tried changing the number to 3000000, 4000000, 5000000, but it wont allow the jpeg file im sending that is 2.22mb, it will allow a file that is 1.8mb, but even though I change the "if( $upload_Size >2000000)" to "if( $upload_Size >3000000)", and re-transfer it to my server it still doesnt work. Im not sure how to check what my server allows, I think this might be the right information: Bandwidth Allotment: 250,000 MB Diskspace Allotment: 5,000 MB but im not sure. So im thinking maybe theres another way I can allow this change? or maybe i need to do more to the script than just change the number??? // CHANGE THIS TO A HIGHER OR LOWER VALUE - REMEMBER HOSTING LIMITS if( $upload_Size >2000000) //-------- { unlink($upload_Temp); die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>"); } if( $upload_Mime_Type != "image/cgm" AND $upload_Mime_Type != "image/g3fax" AND $upload_Mime_Type != "image/gif" AND $upload_Mime_Type != "image/ief" AND $upload_Mime_Type != "image/pjpeg" AND $upload_Mime_Type != "image/jpeg" AND $upload_Mime_Type != "image/naplps" AND $upload_Mime_Type != "image/png" AND $upload_Mime_Type != "image/prs.btif" AND $upload_Mime_Type != "image/prs.pti" AND $upload_Mime_Type != "image/tiff" AND $upload_Mime_Type != "image/vnd.cns.inf2" AND $upload_Mime_Type != "image/vnd.dwg" AND $upload_Mime_Type != "image/vnd.dxf" AND $upload_Mime_Type != "image/vnd.fastbidsheet" AND $upload_Mime_Type != "image/vnd.fpx" AND $upload_Mime_Type != "image/vnd.fst" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-mmr" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-rlc" AND $upload_Mime_Type != "image/vnd.mix" AND $upload_Mime_Type != "image/vnd.net-fpx" AND $upload_Mime_Type != "image/vnd.svf" AND $upload_Mime_Type != "image/vnd.wap.wbmp" AND $upload_Mime_Type != "image/vnd.xiff" ) { unlink($upload_Temp); die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>"); } $uploadFile = "uploads/".$upload_Name ; if (!is_dir(dirname($uploadFile))) { @RecursiveMkdir(dirname($uploadFile)); } else { @chmod(dirname($uploadFile), 0777); } @move_uploaded_file( $upload_Temp , $uploadFile); chmod($uploadFile, 0644); oh and, thats not the full code, just a snipet that had to do with the file size, I didnt see any other part of the script related to uploading. Quote Link to comment https://forums.phpfreaks.com/topic/89985-allowing-larger-upload-file/ Share on other sites More sharing options...
JacobYaYa Posted February 8, 2008 Share Posted February 8, 2008 Is this on your own development server or have you got this up on live webhosting? I know my host, Dreamhost, limits file uploads to 2mb. I think you have to use perl to get around it. Quote Link to comment https://forums.phpfreaks.com/topic/89985-allowing-larger-upload-file/#findComment-461362 Share on other sites More sharing options...
ponies3387 Posted February 8, 2008 Author Share Posted February 8, 2008 my hosting server is with godaddy, im not sure how to find out what the limit is... maybe then I could change it Quote Link to comment https://forums.phpfreaks.com/topic/89985-allowing-larger-upload-file/#findComment-461396 Share on other sites More sharing options...
JacobYaYa Posted February 8, 2008 Share Posted February 8, 2008 some info also try adding the below lines to .htaccess php_value post_max_size 8M php_value upload_max_filesize 8M Quote Link to comment https://forums.phpfreaks.com/topic/89985-allowing-larger-upload-file/#findComment-461434 Share on other sites More sharing options...
ponies3387 Posted February 8, 2008 Author Share Posted February 8, 2008 apparently, they do not set any limit lower than 8mb, so I should be fine. Therefore, there must be something wrong with the way im changing the code, any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/89985-allowing-larger-upload-file/#findComment-461492 Share on other sites More sharing options...
bluebyyou Posted February 8, 2008 Share Posted February 8, 2008 I also had this issue with a godaddy account. What I did was add a custom php.ini file in my root directory. You can specify your own upload limits then. Quote Link to comment https://forums.phpfreaks.com/topic/89985-allowing-larger-upload-file/#findComment-461606 Share on other sites More sharing options...
ponies3387 Posted February 8, 2008 Author Share Posted February 8, 2008 thats sounds like a good idea, but can u be more specific? What do I write into the file and do I put it into a certain directory? Quote Link to comment https://forums.phpfreaks.com/topic/89985-allowing-larger-upload-file/#findComment-461617 Share on other sites More sharing options...
Wolphie Posted February 8, 2008 Share Posted February 8, 2008 1KB = 1024 1MB = 1024 / 1024 Therefore, do something like <?php function fileSize() { $filesize = $_FILES['file']['size']; $filesize = $filesize / (1024 / 1024); if($filesize >= 5) { echo 'Your file is larger than 5MB'; } else { echo 'Your filesize is below 5MB'; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/89985-allowing-larger-upload-file/#findComment-461618 Share on other sites More sharing options...
Wolphie Posted February 8, 2008 Share Posted February 8, 2008 1KB = 1024 1MB = 1024 / 1024 Therefore, do something like <?php function fileSize() { $filesize = $_FILES['file']['size']; $filesize = $filesize / (1024 / 1024); $filesize = floor($filesize); if($filesize >= 5) { echo 'Your file is larger than 5MB'; } else { echo 'Your filesize is below 5MB'; } } ?> Try that even Quote Link to comment https://forums.phpfreaks.com/topic/89985-allowing-larger-upload-file/#findComment-461619 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.