<?php 
include('includes/config/config.php');
include('includes/auth/auth.php');
$this_script='upload_logo.php';
?>
<?php 
if(isset($hid) && $hid=='1')
{
      $allowed_filetypes = array('.jpg','.jpeg','.JPG','.JPEG', 'ico','ICO'); // These will be the types of file that will pass the validation.
      $upload_path = './images/'; // The place the files will be uploaded to (currently a 'files' directory).
 
   $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension).
   $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename.
 
   if(!in_array($ext,$allowed_filetypes))
      die('The file you attempted to upload is not allowed.<br><button onclick="history.back();">Back</button>'); 
 
   //if(!is_writable($upload_path))
     // die('You cannot upload to the specified directory, please CHMOD it to 777.');
 
   if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename))
         $msg = $filename;
      else
         $msg = 'There was an error during the Logo upload. Please try again.';

echo "<script>window.opener.document.f1.firm_logo.value = '".$msg."';window.close();</script>";

} 
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
  <tr>
    <td height="350" valign="top" style="padding:10px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>

        <td><fieldset class="bdr1" >
<?php if($acn=='upload') {?>
	<legend class="heading1">Upload Logo
	</legend>
	<center>
<form action="<?php  echo $this_script?>" method="post" enctype="multipart/form-data">
   <p>
      <label for="file">Select a file:</label><input type="file" name="userfile" id="file"> <br />
      <button>Upload Logo</button>
   <p>
<input type="hidden" name="hid" value="1">
</form>
    </center>
             </fieldset>
<?php } else {?>
<legend class="heading1">Select Logo
	</legend>
	<center>
<form action="<?php  echo $this_script?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="hid" value="1">
</form>
    </center>
             </fieldset>
<?php }?>




</td>

      </tr>
    </table></td>
  </tr>