if (isset($_GET['file']) and preg_match("/^[a-zA-Z0-9_\.\/\-]{0,50}\.(xml|txt|pdf|png|gif|jpg|jpeg|exe|doc|xls|ppt|zip|)$/",$_GET['file']) and file_exists($_GET['file'])) { $extension = strtolower(substr(strrchr($_GET['file'],"."),1)); switch ($extension) { case "txt": $ctype="text/plain"; break; case "pdf": $ctype="application/pdf"; break; case "exe": $ctype="application/octet-stream"; break; case "zip": $ctype="application/zip"; break; case "doc": $ctype="application/msword"; break; case "xls": $ctype="application/vnd.ms-excel"; break; case "ppt": $ctype="application/vnd.ms-powerpoint"; break; case "gif": $ctype="image/gif"; break; case "png": $ctype="image/png"; break; case "jpeg": $ctype="image/jpg"; break; case "jpg": $ctype="image/jpg"; break; default: $ctype="application/force-download"; } header('Content-Type: '.$ctype.'; charset=utf-8'); header("Content-Disposition: attachment; filename=".$_GET['file']); ob_clean(); readfile($_GET['file']); exit(); } else { echo "Файл не найден."; exit(); }

Внимание! это сообщение появляется в Демо-версии.