rondog Posted May 7, 2008 Share Posted May 7, 2008 I am working on an upload script and for some reason its saying its the wrong filetype. I want it to only accept jpg or gif, but even if I provide those, it still says incorrect file type: <?php $uploaded_image = $_FILES['imgfield']['name']; $type = $_FILES['imgfield']['type']; $tmpimg = $_FILES['imgfield']['tmp_name']; $name = $_POST['namefield']; if(!$name || !$uploaded_image) { $error = "<span class=\"error\">Please fill in all fields.</a>"; } elseif($type != "image/jpeg" || $type != "image/gif") { $error = "<span class=\"error\">$type Incorrect file type. Jpg or Gif.</a>"; } else { $width = imagesx($tmpimg); $height = imagesy($tmpimg); if($width != 150 || $height != 80) { $error = "<span class=\"error\">Wrong Image Size. Must be 150x80.</a>"; } else { $success = "<span class=\"success\">Successfully added.</a>"; } } } ?> and if I echo $type it says image/jpeg or image/gif depending on what I upload. Link to comment https://forums.phpfreaks.com/topic/104503-upload-type/ Share on other sites More sharing options...
rondog Posted May 7, 2008 Author Share Posted May 7, 2008 never mind I got it Link to comment https://forums.phpfreaks.com/topic/104503-upload-type/#findComment-534994 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.