# HTML File Input - Restrict file extensions?



## Callum_Dawson (Mar 9, 2009)

I've made an upload script so people can upload images onto my web server. That all works nice and good, but I'd like to prevent people being able to upload files other than images. What's the easiest way in HTML code to prevent file extensions being submitted? My HTML code is below:


```
Choose a file to upload:

[/CENTER]
```


----------



## tomdkat (May 6, 2006)

You will need some kind of script (either JavaScript or PHP) to process the file name to control the types of files being uploaded.

Peace...


----------



## Squashman (Apr 4, 2003)

http://www.quackit.com/php/tutorial/php_upload_file.cfm
Might want to Google search 
php upload restrict file type


----------



## Mawer IV (Jun 24, 2007)

A server-side script is the only safe way, e.g. Squashman's link


----------

