validate UploadField { script manual mandatory }

validate UploadField { script manual mandatory }

Hey community im just curious is there a way i can validate an upload field with a manual mandatory script

 if.UploadField does not contain = ".png, .jpg" 
{ cancel submit; }

or

if = null / "" / 0 

or something along this line ??