brent123456 Posted July 9, 2007 Share Posted July 9, 2007 I can't seem to validated a very large image when uploading. I have tried checking the file size but it the image is like 3 megabytes then it just returns 0 for the byte size. I have tried checking $_FILE[the_image][error] and it will not validate the image either. The code below is working.. $large = false; if ($_FILES['image']['size'] > 220000) { $large = true; } echo $_FILES['image']['size']; echo $_FILES['image']['error']; if ($_FILES['image']['error'] > 0) { $large = true; } // check for image if (is_uploaded_file($_FILES['image']['tmp_name'])) { The trouble is that users don't have to upload a picture when they submit. This is not allowing them to submit without an image file. When I add the code below the if (is_uploaded_file($_FILES['image']['tmp_name'])) it doesn't work at all. Does anyone have a better way to check if a user has uploaded a file and just not do anything it user has not added an image? Thanks, Brent Quote Link to comment Share on other sites More sharing options...
Carterhost Posted July 9, 2007 Share Posted July 9, 2007 You could try something like: <?php if (!$_FILES['image']['name']=="") { PROCESS IMAGE } else{ DO SOMETHING ELSE } ?> I used this just the other day and it worked Quote Link to comment Share on other sites More sharing options...
brent123456 Posted July 9, 2007 Author Share Posted July 9, 2007 thanks carterhost I will give that a shot and get back. 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.