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 Link to comment https://forums.phpfreaks.com/topic/59156-solved-trouble-validating-very-large-images/ 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 Link to comment https://forums.phpfreaks.com/topic/59156-solved-trouble-validating-very-large-images/#findComment-293799 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. Link to comment https://forums.phpfreaks.com/topic/59156-solved-trouble-validating-very-large-images/#findComment-293843 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.