Jump to content

[SOLVED] check extension


ballouta

Recommended Posts

And you should also check if the file really is a ZIP, and not just a spoofed file with the zip extension. Code:

 

<?php
//$filedata is the data of the uploaded file
$start = substr($filedata, 0, 4);
if ($start == "PK\003\004") {
//data is ZIP file including packed files
} elseif ($start == "PK\005\006") {
//data is an empty ZIP file
} else {
//spoofed data, not a ZIP file
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.