⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 process_upload.php

📁 dir list......................................................
💻 PHP
字号:
<?PHP
//dirLIST v0.2.0 file upload processor
require("config.php");

if($file_uploads !=  1)
{
	header("Location: ../index.php");
	exit;
}
//some servers return empty $_POST and $_FILES arrays when the file size is too large
if(empty($_POST) || empty($_FILES))
{
	header("Location: ../index.php?err=".base64_encode("upload_error"));
	exit;
}

//check if file is too big
if($_FILES['file']['error'] == 1)
{
	header("Location: ../index.php?err=".base64_encode("size"));
	exit;
}

//check if any file was uploaded
if($_FILES['file']['error'] == 4)
{
	header("Location: ../index.php?err=".base64_encode("nofile"));
	exit;
}

if($_POST['submit'] == "Submit")
{
	$file_name = $_FILES['file']['name'];
	if(get_magic_quotes_gpc()) 
	{ 
		$file_name  = stripslashes($_FILES['file']['name']); 
	}

	$folder = base64_decode($_POST['folder']);
	(substr($folder, -1, 1) != "/" && !empty($folder) ? $folder .= "/" : $folder);
	$new_path = dirname($_SERVER["SCRIPT_FILENAME"])."/../".$dir_to_browse.$folder.$file_name;
	
	if(in_array(strtolower(strrchr($file_name, ".")), $banned_file_types))
	{
		header("Location: ../index.php?folder=".$_POST['folder']."&err=".base64_encode("upload_banned"));
		exit;
	}
	
	if(move_uploaded_file($_FILES['file']['tmp_name'], $new_path))
	{
		header("Location: ../index.php?folder=".$_POST['folder']);
		exit;
	}	
	else
	{
		header("Location: ../index.php?folder=".$_POST['folder']."&err=".base64_encode("upload_error"));
		exit;
	}
}
else
{
	header("Location: ../index.php?err=".base64_encode("upload_error"));
	exit;
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -