<html>
<head>
<title>File Uploader</title>
</head>
<body bgcolor = "#FFFFFF">


<center>--- 
<img border=0 src=./images/computer1.GIF width=32 height=32> FILE UPLOAD ---</center><br>
</body></html>
<?php
/***************************************************************************
 *			uploader.php                                       *
 *                     	          				           *
 *   File Info:		  Uploading file                                   *
 *   Copyright:       Copyright 2003 http://www.128concepts.com            *
 *						                           * ***************************************************************************/
if ($_SERVER['REQUEST_METHOD'] == "POST") 
  {
        # escape data and set variables
        $folder= addslashes($_POST["folder"]);
       
}

##### test if correct extension for correct folder

if ($folder == "images")
{
	$ext = substr($file_name,-4);
	if ($ext == ".png" or $ext == ".jpg" or $ext == ".jpeg" or $ext == ".gif" or $ext == ".bmp")
{

}
else
{
	echo "<hr><center>$ext not correct graphics extension...<br>Please go back and try again !!!!</center><hr>";
	echo "<br><br><center><a href=javascript:history.back()><img src=images/previous-1.gif border = 0 alt=Back></a></center><br>";
	exit();
}
}

if ($folder == "info")
{
	$ext = substr($file_name,-4);
	if ($ext == ".txt")
{

}
else
{
	echo "<hr><center>$ext not correct textfile extension...<br>Please go back and try again !!!!</center><hr>";
	echo "<br><br><center><a href=javascript:history.back()><img src=images/previous-1.gif border = 0 alt=Back></a></center><br>";
	exit();
}
}

if ($file_name != "")
{
	# copy to folder images
	if ($folder == "images")
	copy("$file","./images/$file_name")
		or die("Could not copy and upload file....");
	# copy to folder info
	if ($folder == "info")
	copy("$file","./info/$file_name")
		or die("Could not copy and upload file....");
}
else
{
	
	echo "<hr>No file specified/Cannot upload the file...<br>Please go back and try again !!!!<hr>";
	echo "<br><br><center><a href=javascript:history.back()><img src=images/previous-1.gif border = 0 alt=Back></a></center><br>";
	exit();
}
?>
<html><head><title>Upload completed...</title>
<script language="JavaScript">
function newWindow(mypage,myname,w,h,features) {
  if(screen.width){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}</script>
</head>
<body bgcolor = "#CCDDFF">
<center><img src=./images/line.gif width=400 height=1 border=0><br>File upload succeeded...<img src=./images/line.gif width=400 height=1 border=0><br></center>
<ul>
<li><b>Sent:-</b> <?php echo "$file_name";?>
<li><b>Size:</b> <?php echo "$file_size";?> bytes
<li><b>Type:</b> <?php echo "$file_type"; ?>
</ul>
<br>
<?php

if ($folder == "images")
{
echo "
<a href= javascript:newWindow('./viewimage.php?$file_name','acePopup',350,300,'scrollbars=yes')><center><img src =./images/searchs.gif width=20 height=24 border = 0 alt=Info>View Image</a> ";
echo "  <a href = ./filemng.php?image=./images/+$file_name>View Graphic Files</a></center><br>";
}
if ($folder == "info")
{
echo "
<a href= javascript:newWindow('./viewinfo.php?$file_name','acePopup',350,300,'scrollbars=yes')><center><img src =./images/searchs.gif width=20 height=24 border = 0 alt=Info>View Info File</a> ";
echo "  <a href = ./filemng.php?info=./info/+$file_name>View Information Files</a></center><br>";
}

echo "<br><font face=verdana size=2 color = navy>You can delete the file if you Click link for either View Graphic Files or View Information Files. Click the trash icon to perform deletion of file.</font>";

echo "<br><center><a href=javascript:history.back()><img src=images/previous-1.gif border = 0 alt=Back></a></center><br>";

?>
</body>
</html>