Jump to content
php.lv forumi

file extension


osk

Recommended Posts

fails: fails.doc.zip.jPg.pNG

apgriez stringu otraadi

GNp.gPj. ...

peec punkta sadali uz puseem

njem pirmo masiiva elementu, paarvert visu uz mazajiem burtiem

un pagriez stringu atpakalj ...

ieguusi png :)

fcija no manuaalja:

http://lv.php.net/manual/en/function.strstr.php#51929

With regard to robbie and the post at "04-Mar-2005 04:52": if a filename contains more than one full stop, the two scripts below will fail in finding to correct file extension.

The following code handles filenames like "document.about.ducks.doc" correctly.

function findtype($file) {
  $revfile = strrev($file);
  $type = strtolower( strrev(substr($revfile,0,strpos($revfile,"."))) );

  return $type;
}

Link to comment
Share on other sites

×
×
  • Create New...