how to check swf banner format, dimension and file size

Discussion in 'PHP' started by adsegzy, Nov 5, 2010.

  1. #1
    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)?
     
    adsegzy, Nov 5, 2010 IP
  2. krsix

    krsix Peon

    Messages:
    435
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    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.
     
    krsix, Nov 5, 2010 IP
  3. backlinkneeded

    backlinkneeded Member

    Messages:
    285
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #3
    @krsix is right. thanks man.
     
    backlinkneeded, Dec 22, 2010 IP