break; case "document": $C_MaxSize = $MaxDocumentSize; $Filter_Array = explode(",", strtolower($DocumentFilters)); $C_Path = $FilesGalleryPath; $C_AbsolutePath = $AbsoluteFilesGalleryPath; $Filter = $DocumentFilters; break; default: break; } $C_AbsolutePath = ServerMapPath($filepath, $C_AbsolutePath, $C_Path); if (substr($C_Path, strlen($C_Path) - 1) != "/") { $C_Path = $C_Path . "/"; } $C_MaxSize = GetMaxSize($C_MaxSize); ?> <form action="upload_handler.php?<?php echo $setting; ?> &Theme=<?php echo $Theme; ?> &FP=<?php echo $FilePath; ?> &Type=<?php echo $file_Type; ?> " enctype="multipart/form-data" method="post">
$f_basename = $mvcfile->FileName; $f_basename = preg_replace("/[^a-zA-Z0-9s.]/", "_", $f_basename); $savepath = $C_AbsolutePath . '/' . $f_basename; $savepath = str_replace("//", "/", $savepath); if (is_file($savepath)) { unlink($savepath); } $mvcfile->MoveTo($savepath); chmod($savepath, 0644); echo "The file " . $f_basename . " has been uploaded successfully! <br>"; echo "File size: " . FormatSize($filesize) . "."; echo "<script language=javascript>parent.UploadSaved('" . $filepath . $f_basename . "','" . $filepath . "');</script>"; } } else { $maxsize = ini_get('upload_max_filesize'); $maxsize = GetMaxSize($maxsize); echo "File is not uploaded. Server rejected file. <br>"; echo "The uploaded file exceeds the server upload file limitation: " . FormatSize($maxsize); } function FormatSize($size) { // Setup some common file size measurements. $kb = 1024; // Kilobyte $mb = 1024 * $kb; // Megabyte $gb = 1024 * $mb; // Gigabyte $tb = 1024 * $gb; // Terabyte /* If it's less than a kb we just return the size, otherwise we keep going until