There is an html attribute for this specific purpose called accept
but it has little support across browsers. Because of this server side validation is recommended instead.
<input type="file" name="pic" id="pic" accept="image/gif, image/jpeg" />
If you don’t have access to the backend have a look at a flash based solution like SWFUpload.
See more on this here: File input ‘accept’ attribute – is it useful?