note 50334 deleted from function.zip-entry-filesize by nlopess
| From: | nlopess@php.net | Date: | Fri, 25 Feb 2005 18:43:44 +0000 |
| Subject: | note 50334 deleted from function.zip-entry-filesize by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-85555@lists.php.net to get a copy of this message | ||
Note Submitter: jay dot kamminga at home dot nl
Reason: bad code
----
I needed the following code myself, perhaps someone else needs it too:
<?php
function zip_entry_filetype($zip_entry) {
// What is the filename?
$filename = zip_entry_name($zip_entry);
// If the filename contains a dot (".") return everything behind the dot.
if (strstr($filename, ".")) $filetype = preg_replace("/^(.*?)\.([^\.]+)$/",
"\\2", $filename);
// If not so, return file (unkown, any file)
else $filetype = "file";
return($filetype);
} // zip_entry_filetype.
?>
Hope this comes in handy to anyone.
Greetings, Jay