Hi all,
On a site I am developing, there is an area for users to upload an image of themselves. The actual upload code works, but the code I have in place is not grabbing the width/height of the image (to make sure it doesn't exceed the maximum dimensions). The form code is as follows:
Further down the page, I think check to see whether $_POST['photo'] == 'main' and if so, execute the following code:Code:<form method="POST" action="photo_admin.php" enctype="multipart/form-data"> <input type="hidden" name="photo" value="main" /> <input type="file" name="main"> <input type="submit" name="Submit" value="Upload New Image" class="flatButton" /> </form>
Any help would be much appreciated.PHP Code:$imgData = getimagesize($_FILES['main']['tmp_name']);
$imgWidth = $imgData[0];
$imgHeight = $imgData[1];
if (($imgWidth > 800) || ($imgHeight > 600)) {
echo ('<span class="error">Uploaded images must not exceed 800x600 pixels in size.</span>' . BR . BR . 'Click <a href="photo_admin.php">here</a> to go back and try again.');
} else {
// Upload image
}
-Will








Bookmarks