RE: [PHP] Check the contents of a file field
| From: | Jennifer Goodie | Date: | Mon, 05 May 2003 22:51:12 +0000 |
| Subject: | RE: [PHP] Check the contents of a file field | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146465@lists.php.net to get a copy of this message | ||
If you are checking before you submit the form, you need to use javascript.
If you are checking after the form is submitted you use PHP. The PHP answer
has already been given. The javascript way would be something like
if(document.forms[0].fieldname.value == ''){
alert "The file field was not filled out."
return false;
}
Of course your form might not be form[0] and your field is probably not
called fieldname and I am not the Queen of Javascript, so you'll probably
need to test this. But it is not like this is the javascript help list,
anyway.
> -----Original Message-----
> From: shaun [mailto:shaun@mania.plus.com]
> Sent: Monday, May 05, 2003 3:44 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Check the contents of a file field
>
>
> Thanks for your reply, but I am actually just trying to test whether the
> field was left empty before submitting the form...