I am currently working on a project in which users can upload images and GPX files. There is no problem checking the images, but I just cannot find a safe way to make sure that the gpx files are not some kind of malicious file. Any hints are greatly appreciated! Thanks in advance!
Edit: can anyone please indicate why this code is not working? By not working, I mean that it does not reject PDF files.
$xml = new XMLReader();
if (!$xml->xml($_FILES["gps"]["tmp_name"], NULL, LIBXML_DTDVALID)) {
echo '<script>alert("Not valid!");</script>';
exit();
}
source
share