Public feed #602216

Unnamed

public text v1 · immutable
Raw Edit
·published 2007-07-03 23:16 UTC
rendered paste body
<?php
if(isset($_GET['start_upload']) && $_GET['txt_file'] != ""){
   $local_file = $_GET['txt_file']; // Defines Name of Local File to be Uploaded
	list($var1, $var2,) = split('[.]', $local_file);
	$fname = $_GET['year'].".".$var2;
	$destination_file = "./common/image/potw/year".$fname;  // Path for File Upload (relative to your login dir)
	echo $local_file;
	echo $destination_file;

	elseif (($_FILES['txt_file']['type'] == "image/gif")		|| 
		($_FILES['txt_file']['type'] == "image/jpeg")		|| 
		($_FILES['txt_file']['type'] == "image/png")		|| 
		($_FILES['txt_file']['type'] == "image/bmp")		|| 
		($_FILES['txt_file']['type'] == "image/x-bmp")		||
		($_FILES['txt_file']['type'] == "image/x-win-bmp")	||
		($_FILES['txt_file']['type'] == "image/x-windows-bmp")	||
		($_FILES['txt_file']['type'] == "image/x-xbitmap")	||
		($_FILES['txt_file']['type'] == "image/pjpeg")
	       )
	{
		copy ($_FILES['txt_file']['tmp_name'], $destination_file) or echo ("Copy Failure");
		echo "<p>";
		echo "Image uploaded successfully.";
		echo "</p>";
	}
}else if(isset($_GET['start_upload']) && $_GET['txt_file']['name'] == ""){
echo"
Please enter a file name.
";
};

?>

<html>
   <head>
       <script type="text/javascript">
           window.onload = function() {
               document.getElementById("progress").style.visibility = "hidden";
               document.getElementById("prog_text").style.visibility = "hidden";
           }
           
           
       </script>
       
   </head>
   <body>
   	<?php
	$yid = $_GET['year'];
	?>
       <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="GET">
           Please choose a file: <input name="txt_file" type="file" size="35" />
		   <input name="year" type="hidden" value="<?php echo $yid;?>">
           <input type="submit" name="start_upload" value="Upload File"/>
       </form>
       
       <!-- Link to progress file: see http://www.ajaxload.info/ for animated gifs -->
       <img id="progress" src="http://www.your.site/images/progress.gif" />
       <p id="prog_text" style="display:inline;"> Upload Started!</p>
       
   </body>
<html>