This is really a client-side thing (PHP can't help).
There is an attribute called "accept" that can be used on an input element for file selection that would (theoretically) do this by specified MIME type, but it isn't really supported by browsers. The next best thing is to implement something in flash for file uploads. You would then have control to filter the filetypes the user sees by default in their file selection window.
You can give
SWFUpload a shot for starters (it seems to be a popular choice). It has a flag called "file_types" that can be set (as well as a description caption for the file types you choose to allow):
Code:
<script type="text/javascript">
var swfu;
window.onload = function () {
swfu = new SWFUpload({// File Upload Settings
file_size_limit : "8 MB", // 2MB
file_types : "*.jpg; *.gif",
file_types_description : "Image Files (JPG, GIF)",
file_upload_limit : "0",
});
};
</script>