This topic is locked

Check file extension not working

6/11/2012 4:21:43 PM
PHPRunner General questions
S
scoobysteve author

Hi guys I am trying to use the code suggested in the help files to check my image file extensions but its not working
I am using the following in "before record added" it always coming back with the same result Wrong file type selected
$exttype = CheckImageExtension($_FILES["valueMainImage".postvalue("id")]["name"]);

if ($exttype <> ".JPG")

{

$message = "<<< Wrong file type selected >>>";

return false;

}

Also I have the field name of MainImage that I want to check so is this part right "valueMainImage" or should it be "MainImage"
Can anyone tell me what the ("id")]["name"]) parts are referring too, are they meant to match a field in my database, also how do I change the following to accept multiple file types if ($exttype <> ".JPG")

C
cgphp 6/12/2012

Try to print the $exttype value:

$exttype = CheckImageExtension($_FILES["value_MainImage_".postvalue("id")]["name"]);

$message = $exttype;

return false;
S
scoobysteve author 6/12/2012



Try to print the $exttype value:

$exttype = CheckImageExtension($_FILES["value_MainImage_".postvalue("id")]["name"]);

$message = $exttype;

return false;



Hi thanks for your help but this doesn't return any result

C
cgphp 6/12/2012

Make sure MainImage is the real name of the field.

S
scoobysteve author 6/12/2012



Make sure MainImage is the real name of the field.


Cristian,
thanks for your reply yes it is I have attached a image showing the field.

C
cgphp 6/12/2012

Try to print the $_FILES array.

S
scoobysteve author 6/12/2012



Try to print the $_FILES array.


how do I do that please

Sergey Kornilov admin 6/12/2012

https://www.google.com/search?q=php+print+array
Once printed, post the output here.