Re: test for rtf
| From: | bill | Date: | Sat, 08 Mar 2003 15:02:36 +0000 |
| Subject: | Re: test for rtf | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138753@lists.php.net to get a copy of this message | ||
Just a note, testing for those characters is trickier than it sounds. The
backslash throws off the test. Here's what I did on a POST form. Note the
-two- backslashes.
$chkstring=substr($thisfile,0,5);
if ("$chkstring" != "{\\rtf") {
// fail
}
This seems to work, but I'm wondering if there's a better way.
Brady Hegberg wrote:
> You could always open it and see if the first few characters are
> "{\rtf1".
>
> Brady
>
> > Is there any way to test a file to confirm it is an RTF file?
> >
> > I'm thinking along the lines of how we can test for an image with
> > getimagesize().
> >
> > kind regards,
> >
> > bill
> >