All pastes #767646 Raw Edit

Something

public text v1 · immutable
·published 2007-11-09 22:40 UTC
rendered paste body
<head>
<title>Uploading...</title>
</head>
<?php
$file_dir = "upload/";
foreach($_FILES as $file_name => $file_array) {
	echo "Path: ".$file_array["tmp_name"]."<br/>\n"; //The old file path
	echo "Name: ".$file_array["name"]."<br/>\n"; //The name of the file
	echo "Type: ".$file_array["type"]."<br/>\n"; //The type of the file
	echo "Size: ".$file_array["size"]." bytes.<br/>\n"; //The size of the file (in bytes)

	if (is_uploaded_file($file_array["tmp_name"])) {
		move_uploaded_file($file_array["tmp_name"], "$file_dir/".$file_array["name"]) or die ("The blasted file wouldn't move. Try again.");
		echo "The file moved! Hurrah!<br/>";
	}
}
?>