The14thGOD Posted June 24, 2007 Share Posted June 24, 2007 I'm having a problem of uploading an image, it keeps saying the file is not the correct size..but it is the same size. Perhaps I'm missing something? Or perhaps a server/php reads the size a little different? here's the code if anyone can take a look at it and help me id be very great full: <?php import_request_variables('pg'); //First check that file ext = .jpg then rename file and location, also upload to perminate location{ $extension = explode('.',$_FILES['photo']['name']); if ($extension[1] == 'jpg') { $uploaddir = '../images/news/'; $filename = $_FILES['photo']['name']; $file_dir = "$uploaddir" . "$filename"; move_uploaded_file($_FILES['photo']['tmp_name'], "$file_dir"); $size = getimagesize($file_dir); if($size[0] != 334 or $size[1] != 184) { $error = 'file'; unlink($file_dir); header("Location: add_news.php?error=$error"); exit(0); } $size_true = 'true'; } elseif ($extension[1] !== 'jpg' or !$size_true) { $error = 'file'; header("Location: add_news.php?error=$error"); exit(0); }?> Thanks in advance Link to comment https://forums.phpfreaks.com/topic/56909-uploading-image-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.