Re: Restricting mime type in file uploads?

From: Date: Wed, 07 Aug 2002 10:49:27 +0000
Subject: Re: Restricting mime type in file uploads?
Groups: php.db 
Request: Send a blank email to php-db+get-21042@lists.php.net to get a copy of this message
I like to do this with javascript before the form is being submitted. I think it is cleaner that way. // where res is your file field function valid(form) { var dotPos = res.lastIndexOf("."); var fileExt = res.substr(dotPos); if (document.attach.resume.value) { if ((fileExt != ".jpg") { alert("We can only accept jpg format\n"); } } } there may be a mistake or two in this code, as i took this from a larger chunk of javascript from a resume app that i'm using but it will give you the idea. hth jeff "Dave Carrera" <dave@davecarr To: <php-db@lists.php.net> era.com> cc: Subject: [PHP-DB] Restricting mime type in file uploads? 08/07/2002 03:19 AM Hi All I have a working ap to allow clients to upload their images to a server & then I write the path to a MySql db for retrieval later. But I have been asked if we can control the mime type to only accept JPG's and nothing else. I can't seem to find the answer anywhere so I humbly ask for your help or guidance. Thank you in advance Dave C

« previous php.db (#21042) next »