Landsat7 Posted September 13, 2004 Report Share Posted September 13, 2004 Domaaju uztaisiit download.php kursh ljauj kopeet tikai noteiktus failus (rar, zip, exe, u.c.) savaadaak ja ljoti grib ir iespeejams nokopeet arii citus php failus no manas lapas. Iespruudu pie taa ka nezinu kaa lai nosaka faila extension. Link to comment Share on other sites More sharing options...
bubu Posted September 13, 2004 Report Share Posted September 13, 2004 da kautvai šādi: <?php $ext = substr($filename, strpos($filename, '.')+1); ?> Link to comment Share on other sites More sharing options...
Kaklz Posted September 14, 2004 Report Share Posted September 14, 2004 bubu, a ja faila nosaukums ir malicious.file.exe ? tad extension tev būs file.exe, nevis tikai .exe ;) ja šī problēma neuztrauc, tad var droši izmantot bubu variantu, es parasti to daru ar explode: $parts = explode('.', $filename); $extension = $parts[count($parts) - 1]; Link to comment Share on other sites More sharing options...
bubu Posted September 14, 2004 Report Share Posted September 14, 2004 Kaklz, es jau sapratu, ka viņš no sava saita failus piedāvās downloadot, tad jau liela jēga sevi čakarēt ar kreisajiem extensioniem nav :) Link to comment Share on other sites More sharing options...
Venom Posted September 14, 2004 Report Share Posted September 14, 2004 $ext=substr(strrchr($filename,'.'),1); Link to comment Share on other sites More sharing options...
Venom Posted September 14, 2004 Report Share Posted September 14, 2004 $parts = explode('.', $filename);$extension = $parts[count($parts) - 1]; $extension=array_pop($parts); Link to comment Share on other sites More sharing options...
Recommended Posts