vurentjie Posted March 6, 2008 Share Posted March 6, 2008 hi i am trying to set a max file size for uploading an image, the upload and deleting functions work fine, except for the fact that when i put my stuff online the max_file_size is ignored, but when i work offline it seem to work fine, i have chopped and changed the code to get it to work but to no avail, i first started off defining a constant define('max',51200); then i just set a $var = 51200; either way seems to work offline if (array_key_exists('upload', $_POST)) { $l_pc_upresult = "SELECT DISTINCT * FROM .........."; $l_pc_upquery = @mysql_query($l_pc_upresult); while($pc=mysql_fetch_array($l_pc_upquery)) { // define constant for upload folder define('UPLOAD_DIR', '../picfolder/'); $l_pc_save = $pc['........']."_".$a_real_add_pc.".jpg"; if ($_FILES['image']['size'] <= MAX_FILE_SIZE) { // move the file to the upload folder and rename it move_uploaded_file($_FILES['image']['tmp_name'], UPLOAD_DIR.$l_pc_save); $NO = ""; } elseif($_FILES['image']['size'] > MAX_FILE_SIZE) { $NO = "<div style='color:red'>SORRY IMAGE SIZE EXCEEDED - PLEASE OPTIMIZE OR RESIZE</div><br/>"; } elseif($_FILES['image']['size'] < 0) { $NO = "<div style='color:red'>SORRY IMAGE SIZE EXCEEDED - PLEASE OPTIMIZE OR RESIZE</div><br/>"; } else { $NO = "<div style='color:red'>SORRY IMAGE SIZE EXCEEDED - PLEASE OPTIMIZE OR RESIZE</div><br/>"; } } } i have tried many variations of this even a switch statement that checks the $_FILES['image']['error']; but as i said it works offline, but online even if the max is reached the file still writes to the folder is their something i am missing? Quote Link to comment Share on other sites More sharing options...
vurentjie Posted March 6, 2008 Author Share Posted March 6, 2008 never mind problem solved.... Quote Link to comment 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.