Landsat7 Posted September 13, 2004 Report 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.
bubu Posted September 13, 2004 Report Posted September 13, 2004 da kautvai šādi: <?php $ext = substr($filename, strpos($filename, '.')+1); ?>
Kaklz Posted September 14, 2004 Report 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];
bubu Posted September 14, 2004 Report 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 :)
Venom Posted September 14, 2004 Report Posted September 14, 2004 $ext=substr(strrchr($filename,'.'),1);
Venom Posted September 14, 2004 Report Posted September 14, 2004 $parts = explode('.', $filename);$extension = $parts[count($parts) - 1]; $extension=array_pop($parts);
Recommended Posts