NYCPHP Meetup

NYPHP.org

[nycphp-talk] file -ib? Re: Using $FILES["whatever"]["type"] correctly

Webapprentice . webapprentice at mail.com
Wed Jan 14 11:01:35 EST 2004


Eric,
I'm not well-versed in UNIX.  How do I invoke a command-line program in PHP?  Is there something like a system() call in some other languages? 

--Stephen

>>>>
Message: 6
Date: Wed, 14 Jan 2004 14:28:36 +0100
From: Eric Persson <eric at persson.tm>

Subject: Re: [nycphp-talk] Using
$_FILES["whatever"]["type"] correctly
To: NYPHP Talk <talk at lists.nyphp.org>

Message-ID: <40054404.9080303 at persson.tm>

Content-Type: text/plain; charset=us-ascii; format=flowed

Webapprentice . wrote:
>			$imageType =
$_FILES["frontimage"]["type"];


Using the type thats in $_FILES is generally a bad idea, since its
set 
by the browser, and different browsers set different types for the
same 
file. I usually use the *nix program file program to determine the 
filetype, then you know that it will always return the same typ for
the 
same type of files.

Something like
file -ib <filename>
gives the type on the last line.

Just my idea. :)

//Eric<<<

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm




More information about the talk mailing list