Forum Moderators: coopster

Message Too Old, No Replies

Need to detect Windows vs Mac files upon user upload

         

mgm_03

8:32 pm on Jun 22, 2004 (gmt 0)

10+ Year Member



We have a need to ensure a user is uploading an acceptable file format (image artwork). The company only supports Windows and would like to know if it's possible to discern between Windows and Mac. Then let the user know the file was acceptable or not.

Is file platform detection possible with PHP?

Does anyone have thoughts?

TIA!

jatar_k

9:02 pm on Jun 22, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



often in the user agent there is info about the platform, maybe get_browser [ca.php.net] would be an option.

The thing is you would have to trust the user agent provided by the browser and that is never 100% reliable.

There may be an ability to interpret the actual file headers but I am not sure what, in particular, you would look for.

>>The company only supports Windows

why?

you better program something to account for Freebsd, Linux etc then as well.

mgm_03

9:22 pm on Jun 22, 2004 (gmt 0)

10+ Year Member



thanks for replying. my thought is to try finding the differences between Windows and mac files. It turns out Mac files have a Data fork and a Resource fork. PC files only have a Data fork. This may be enough for detecting which file is Mac.

if that's correct, the question then is how to detect if a resource fork exists.