All pastes #761656 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-05 01:24 UTC
rendered paste body
<html>
<head>
<title>Uploading</title>
</head>
<body>
<h1>Uploading File(s)</h1>
<?php

	if ($_FILES['userfile']['error'] > 0) {
	echo ' Problem: ';
	switch ($_FILES['userfile']['error']) 
	{
	case 1: echo 'File exceeded upload_max_filesize'; break; 
	case 2: echo 'File exceeded max_file_size'; break; 
	case 3: echo 'File only paritally uploaded'; break;
	case 4: echo 'No File Uploaded'; break; 
	}
	exit;
	}

	if ($_FILES['userfile']['type'] != 'text/plain')
	 {
	echo 'Problem: File is not plain text';
	exit; 
	}

	$upfile = '/articles/'.$_FILES['userfile']['name'] ;

	if (is_uploaded_file($_FILES['userfile']['tmp_name']))
	 {
	if (!move_upload_file($_FILES['userfile']['tmp_name'], $upfile))
	 {
	echo "Problem: Could not move file to destination directory';
	exit;
	}
}
else
{
echo 'Problem: Possible file upload attack.';
exit;
}
echo 'File uploaded successfully.<br><br>';
	
$fp = fopen($upfile, 'r');
$contents = fread ($fp, filesize ($upfile));
fclose ($fp);

$contents = strip_tags($contents);
$fp = fopen($upfile, 'w');
fwrite($fp, $contents);
fclose($fp);
?>
</body>
</html>