Example #1
0
 if (str_contains($filepath, $C_Path)) {
 } else {
     print "The area you are attempting to access is forbidden";
     exit;
 }
 $uploader = new PhpUploader();
 $guidlist = explode("/", $fileguidlist);
 foreach ($guidlist as $fileguid) {
     //$contentType=$_FILES["file"]["type"];
     $mvcfile = $uploader->GetUploadedFile($fileguid);
     if (!$mvcfile) {
         continue;
     }
     $filesize = $mvcfile->FileSize;
     $filemimetype = FindType(GetExtension($mvcfile->FilePath));
     $filemimetype2 = FindType2(GetExtension($mvcfile->FilePath));
     $Is_valid = false;
     if (!in_array(strtolower(GetExtension($mvcfile->FileName)), $Filter_Array)) {
         echo "<span style='font-family: MS Sans Serif; font-size: 9pt; color:red'><b>File format not allowed! Please contact site administrator. </b></span><br><br>";
         echo "<span><a style=\"font-family: MS Sans Serif; font-size: 9pt; vertical-align: top;\" href=\"upload.php?" . $setting . "&FP=" . $_GET["FP"] . "&Type=" . $_GET["Type"] . "\">Upload a new file</a></span>";
         return;
     }
     $C_MaxSize = GetMaxSize($C_MaxSize);
     if ($filesize > $C_MaxSize * 1024) {
         echo "<span style='font-family: MS Sans Serif; font-size: 9pt; color:red'><b>File size (" . FormatSize($filesize) . ") exceeds the maximum size allowed. </b></span><br><br>";
         echo "<span><a style=\"font-family: MS Sans Serif; font-size: 9pt; vertical-align: top;\" href=\"upload.php?" . $setting . "&FP=" . $_GET["FP"] . "&Type=" . $_GET["Type"] . "\">Upload a new file</a></span>";
         return;
     }
 }
 foreach ($guidlist as $fileguid) {
     //$contentType=$_FILES["file"]["type"];
Example #2
0
<?php

error_reporting(E_ALL ^ E_NOTICE);
require "Include_Security.php";
require "Include_Mimetype.php";
$filepath = @$_GET["FP"];
if (substr($filepath, strlen($filepath) - 1) != "/") {
    $filepath = $filepath . "/";
}
if (@$_FILES["file"]["size"] > 0) {
    $filetype = @$_GET["Type"];
    $contentType = $_FILES["file"]["type"];
    $filesize = $_FILES["file"]["size"];
    $filename = $_FILES["file"]["name"];
    $filemimetype = FindType(GetExtension($filename));
    $filemimetype2 = FindType2(GetExtension($filename));
    // echo $filemimetype;
    $C_MaxSize;
    switch (strtolower($filetype)) {
        case "image":
            $C_MaxSize = $MaxImageSize;
            $Filter_Array = explode(",", strtolower($ImageFilters));
            break;
        case "flash":
            $C_MaxSize = $MaxFlashSize;
            $Filter_Array = array(".swf", ".flv");
            break;
        case "media":
            $C_MaxSize = $MaxMediaSize;
            $Filter_Array = explode(",", strtolower($MediaFilters));
            break;