Re: Restricting mime type in file uploads?
| From: | Pierre-Alain Joye | Date: | Wed, 07 Aug 2002 10:56:00 +0000 |
| Subject: | Re: Restricting mime type in file uploads? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21043@lists.php.net to get a copy of this message | ||
On Wed, 7 Aug 2002 06:49:27 -0400
Jeffrey_N_Dyke@Keane.com wrote:
>
> 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");
> }
> }
> }
JS checks before sublit never replace a good server side verification :).
btw, try to reply-to in the correct thread.
pa