Hello friends, am working on a website where adverts will be placed. the advert can be in any of the following formats JPG, JPEG, GIF, PNG or SWF(flash). I used the below code to check for the format of the file, it works when uploading file in JPG, JPEG, GIF, PNG formats but when uploading SWF telling me that the "The Picture format is not supported, upload a supported format". $image_type = strstr(($_FILES["file"]["name"]), '.'); $file_type = (($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/swf")); $file_size = 5242880; if($_FILES["file"]["name"] == "") echo "<span class='style3'>You must upoad your Banner.</span><br>"; elseif (($_FILES["file"]["name"] !="") && $image_type != $file_type) echo "<span class='style3'>The Picture format is not supported, upload a supported format.</span><br>"; PHP: Please how can go about checking the file format, dimension adn size of a flash banner (swf)?
A small issue here might be that the type is "application/x-shockwave-flash", not "image/swf"... Additionally, keep in mind that swf can have craploads of malicious code, so you probably don't want to do automated acceptance of swf ads.