9three Posted January 29, 2010 Share Posted January 29, 2010 Hi, I have an uploader checking if the file is greater than 5mbs, if so display an error but it's not displaying an error nor is it uploading. It seems it works correctly for files around 200kb or less, then it just seems to stall... if ($_FILES['file']['size'] > 5242880 || $_FILES['file']['size'] <= 0) echo 'File size too big or too small'; elseif ($_FILES['file']['error'] != 0) echo 'There was a problem with your upload'; Actually more around 95kb. Quote Link to comment https://forums.phpfreaks.com/topic/190311-not-allowing-upload-over-100kb-200kb-estimation/ Share on other sites More sharing options...
jamiet757 Posted January 30, 2010 Share Posted January 30, 2010 You should probably paste the entire code, the section you gave seems alright, it is likely the problem is somewhere else Quote Link to comment https://forums.phpfreaks.com/topic/190311-not-allowing-upload-over-100kb-200kb-estimation/#findComment-1004016 Share on other sites More sharing options...
9three Posted January 30, 2010 Author Share Posted January 30, 2010 I don't think the problem is the code itself as it works fine for 95kb files or less. I'm thinking its a php.ini problem?? Quote Link to comment https://forums.phpfreaks.com/topic/190311-not-allowing-upload-over-100kb-200kb-estimation/#findComment-1004019 Share on other sites More sharing options...
jamiet757 Posted January 30, 2010 Share Posted January 30, 2010 show the content of your php.ini file These are the values that need to be in it for your script to work: upload_max_filesize = 5M post_max_size = 5M Quote Link to comment https://forums.phpfreaks.com/topic/190311-not-allowing-upload-over-100kb-200kb-estimation/#findComment-1004020 Share on other sites More sharing options...
9three Posted January 30, 2010 Author Share Posted January 30, 2010 which part? Quote Link to comment https://forums.phpfreaks.com/topic/190311-not-allowing-upload-over-100kb-200kb-estimation/#findComment-1004023 Share on other sites More sharing options...
roopurt18 Posted January 30, 2010 Share Posted January 30, 2010 Don't forget that the form also should have a hidden parameter indicating the max file size as well. Quote Link to comment https://forums.phpfreaks.com/topic/190311-not-allowing-upload-over-100kb-200kb-estimation/#findComment-1004036 Share on other sites More sharing options...
schilly Posted January 30, 2010 Share Posted January 30, 2010 there is also a max post limit the in php.ini too i believe. i think the default is 2 megs. Quote Link to comment https://forums.phpfreaks.com/topic/190311-not-allowing-upload-over-100kb-200kb-estimation/#findComment-1004044 Share on other sites More sharing options...
roopurt18 Posted January 30, 2010 Share Posted January 30, 2010 Which jamiet757 already mentioned. Quote Link to comment https://forums.phpfreaks.com/topic/190311-not-allowing-upload-over-100kb-200kb-estimation/#findComment-1004047 Share on other sites More sharing options...
9three Posted January 31, 2010 Author Share Posted January 31, 2010 I've looked into the php.ini option and it shows 10M for both... not sure what it could really be? :-/ Quote Link to comment https://forums.phpfreaks.com/topic/190311-not-allowing-upload-over-100kb-200kb-estimation/#findComment-1004749 Share on other sites More sharing options...
PFMaBiSmAd Posted January 31, 2010 Share Posted January 31, 2010 What does a phpinfo(); statement show for the value for the two settings? (in case the php.ini that you are looking at is not the one that php is using or the syntax being used for the settings is incorrect.) The code you posted is NOT checking if the upload worked without any errors before it attempts to start checking pieces of the uploaded information. Read this link for the things you should be doing to make sure that the upload worked before you start validating any of the uploaded information - http://www.phpfreaks.com/forums/index.php/topic,285703.msg1354833.html#msg1354833 Also, posted in that thread is some debugging code to show the POST/FILES arrays so that you can see exactly what you are receiving as data. Quote Link to comment https://forums.phpfreaks.com/topic/190311-not-allowing-upload-over-100kb-200kb-estimation/#findComment-1004778 Share on other sites More sharing options...
schilly Posted February 1, 2010 Share Posted February 1, 2010 Which jamiet757 already mentioned. ooops. reading the thread first helps =) Quote Link to comment https://forums.phpfreaks.com/topic/190311-not-allowing-upload-over-100kb-200kb-estimation/#findComment-1005093 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.