This topic is locked

image extension ?

7/16/2009 9:39:01 AM
PHPRunner General questions
U
uday author

hi all,
i want to check image extension before upload it . i used following code from PHPRunner Help

[codebox]$exttype = CheckImageExtension($values["file_image"]);

if (($exttype <> ".JPG")||($exttype <> ".PNG"))

{

$message = "<div class=message><<< Wrong file type selected >>></div>";

return false;

}

[/codebox]
But its always shows meassage " Wrong file type selected " even if i upload correct file type(JPG or PNG).

So where i am Wrong?

J
Jane 7/16/2009

Hi,
please see my changes below:

$exttype = CheckImageExtension($values["image"]);

if (($exttype <> ".JPG")||($exttype <> ".PNG"))

{

$message = "<div class=message><<< Wrong file type selected >>></div>";

return false;

}

return true;

U
uday author 7/17/2009

Hi,

please see my changes below:



i tried with above Changes but still not worked for me .always shows meassage " Wrong file type selected " even if i upload correct file type(JPG or PNG). ????? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=42779&image=1&table=forumreplies' class='bbc_emoticon' alt=':blink:' />
i tried with without || operator it works fine but i want to OR condition for all image file types like ".JPG" OR ".PNG" ..???

J
Jane 7/17/2009

Hi,
here is the correct code:

$exttype = CheckImageExtension($values["image"]);

if (($exttype <> ".JPG")&&($exttype <> ".PNG"))

{

$message = "<div class=message><<< Wrong file type selected >>></div>";

return false;

}

return true;