Re: [PHP] test for rtf
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] test for rtf
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] test for rtf
Not to sure on the RTF file format, but checking the first few letters might help Quickly opening a RTF file I see that they start with {\rtf Maybe look for that. Andrew - Original Message - From: bill [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 07, 2003 4:22 PM Subject: [PHP] test for rtf 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] test for rtf
IF this data is being uploaded via form you should look into $_FILES array, in particular $_FILES[userfilename][type]; R On 3/7/03 11:33 AM, Andrew Brampton [EMAIL PROTECTED] wrote: Not to sure on the RTF file format, but checking the first few letters might help Quickly opening a RTF file I see that they start with {\rtf Maybe look for that. Andrew - Original Message - From: bill [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, March 07, 2003 4:22 PM Subject: [PHP] test for rtf 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] test for rtf
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php