OK - here's the skinny:
PPT extension files have a MIME type (PC or Mac) as stated.
PPTX extension
files (PC or Mac) have a MIME type as shown in the line in my
code below -
if (($_FILES['uploadfile']['type'] ==
'application/vnd.ms-powerpoint') ||
($_FILES['uploadfile']['type'] ==
'application/vnd.openxmlformats-officedocument.presentationml.presentation'))
{
This test appears to work as desired. Why would I not want to
use it to
filter all but Powerpoint files?
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote
in message
news:fvk83t$g1j$1@forums.macromedia.com...
> Thanks, Joe! See my reply to Gary's post....
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
>
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
>
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
> ==================
>
>
> "Joe Makowiec" <makowiec@invalid.invalid> wrote in
message
>
news:Xns9A943DE74C4E5makowiecatnycapdotrE@216.104.212.96...
>> On 03 May 2008 in macromedia.dreamweaver.appdev,
Murray *ACE* wrote:
>>
>>> I am building an application to upload PPT
files. I want to test
>>> the incoming filenames to see if it *is* a PPT
file, but cannot find
>>> a MIME type for it. How should I do this so that
I only allow such
>>> files to be uploaded?
>>
>> application/vnd.ms-powerpoint ppt
>>
>>
http://www.w3schools.com/media/media_mimeref.asp
>>
>> I just checked several Powerpoint files - the first
8 bytes are (hex)
>> d0 cf 11 e0 a1 b1 1a e1
>> in all the files I checked. So you can:
>> - upload the file
>> - open the file up and examine the first 8 bytes:
>> $handle = fopen($filename, "rb");
>> $contents = fread($handle, 8);
>> if ($contents != $testvalue) { ...
>> - for dealing with the binary string, see bin2hex
and pack
>>
>>
http://www.php.net/manual/fopen
>>
http://www.php.net/manual/fread
>>
http://www.php.net/bin2hex
>>
http://www.php.net/pack
>>
>> (This is PHP, right?)
>>
>> I'd also examine a few more powerpoint files - I
think that there are a
>> few different types? - to be sure that the signature
I list is
>> characteristic. And remember that Microsoft
completely changed file
>> structures for Office 2007, and that .pptx is
probably completely
>> different to all other previous formats...
>>
>>
http://en.wikipedia.org/wiki/Microsoft_PowerPoint#File_formats
>>
>> --
>> Joe Makowiec
>>
http://makowiec.net/
>> Email:
http://makowiec.net/contact.php
>