178 lines
4.7 KiB
PHP
178 lines
4.7 KiB
PHP
|
<title>Document</title>
|
||
|
<?php
|
||
|
include('top.php');
|
||
|
$this_script='upload.php';
|
||
|
?>
|
||
|
<?php
|
||
|
if(isset($acn) && $acn=='delete')
|
||
|
{
|
||
|
if($file_name)
|
||
|
{
|
||
|
unlink($file_name);
|
||
|
}
|
||
|
$msg="File deleted successfully";
|
||
|
echo "<script>location.replace('$this_script?msg=$msg')</script>";
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
<?php
|
||
|
if(isset($hid) && $hid=='1')
|
||
|
{
|
||
|
//$disallowed_filetypes = array('.php','.asp','.aspx'); // These will be the types of file that will pass the validation.
|
||
|
$upload_path = './files/'; // 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,$disallowed_filetypes))
|
||
|
//die('The file you attempted to upload is not allowed.');
|
||
|
|
||
|
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 = 'Your file upload was successful';
|
||
|
else
|
||
|
$msg = 'There was an error during the file upload. Please try again.';
|
||
|
}
|
||
|
?>
|
||
|
<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" >
|
||
|
|
||
|
<legend class="heading1">LPR
|
||
|
</legend>
|
||
|
<center>
|
||
|
<?php if(isset($acn) && $acn=='add') { ?>
|
||
|
|
||
|
<form action="<?php echo $this_script?>" method="post" enctype="multipart/form-data">
|
||
|
<p>
|
||
|
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bdr_table">
|
||
|
|
||
|
<tr>
|
||
|
<td><label for="file">Upload File:</label></td>
|
||
|
<td><input type="file" name="userfile" id="file"> </td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td><label>PL No:</label></td>
|
||
|
<td><input></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td><label>Item Description:</label></td>
|
||
|
<td><input></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td><label>Drawing:</label></td>
|
||
|
<td><input></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td><label>Run Date:</label></td>
|
||
|
<td><input></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td><label>Fiscal Year:</label></td>
|
||
|
<td><input></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td></td>
|
||
|
<td><button>Upload File</button></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<p>
|
||
|
<input type="hidden" name="hid" value="1">
|
||
|
</form>
|
||
|
<?php } else { ?>
|
||
|
<?php
|
||
|
if ($handle = opendir('files')) {
|
||
|
while (false !== ($file = readdir($handle)))
|
||
|
{
|
||
|
if ($file != "." && $file != "..")
|
||
|
{
|
||
|
$thelist[] = $file;
|
||
|
}
|
||
|
}
|
||
|
closedir($handle);
|
||
|
}
|
||
|
$arr_count=sizeof($thelist);
|
||
|
$upload_path = './files/';
|
||
|
?>
|
||
|
<form>
|
||
|
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bdr_table">
|
||
|
|
||
|
<tr class="bg2">
|
||
|
<td colspan="5" align="center"><font color="maroon"><?php echo $msg?></font></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr class="bg2">
|
||
|
<td align="left" ><strong>S.No.</strong></td>
|
||
|
<td align="left"><strong>Item</strong></td>
|
||
|
<td align="left"><strong>PL No</strong></td>
|
||
|
<td align="left"><strong>Item<br>Description</strong></td>
|
||
|
<td align="left"><strong>Drawing</strong></td>
|
||
|
<td align="left"><strong>Run<br>Date</strong></td>
|
||
|
<td align="left"><strong>Fiscal<br>Year</strong></td>
|
||
|
<td align="left"><strong>Date<br>Upload</strong></td>
|
||
|
<td align="left"><strong>Delete</strong></td>
|
||
|
<td align="left"><strong>Download</strong></td>
|
||
|
</tr>
|
||
|
|
||
|
<?php if($arr_count==0){ ?>
|
||
|
<tr class="bdr_td">
|
||
|
<td align='center' colspan='5' class='bdr_td'><strong>No Files Found</strong></td>
|
||
|
</tr>
|
||
|
<?php } ?>
|
||
|
|
||
|
<?php $count=0;
|
||
|
while($count<sizeof($thelist)) { ?>
|
||
|
|
||
|
|
||
|
<tr class="bdr_td">
|
||
|
<td align="left" class="bdr_td"><?php echo $count+1?></td>
|
||
|
<td align="left" class="bdr_td"></td>
|
||
|
<td align="left" class="bdr_td"></td>
|
||
|
<td align="left" class="bdr_td"><?php echo $thelist[$count]?></td>
|
||
|
<td align="left" class="bdr_td"></td>
|
||
|
<td align="left" class="bdr_td"></td>
|
||
|
<td align="left" class="bdr_td"></td>
|
||
|
<td align="left" class="bdr_td"><?php echo date("d-F-Y", filemtime('files/'.$thelist[$count]))?></td>
|
||
|
<td align="center" class="bdr_td"> <a href="javascript:void(0);" onclick="javascript:deleterecord('<?php echo $this_script?>?acn=delete&file_name=files/<?php echo $thelist[$count]?>');"><img src='images/drop.png' border="0" /></a></td>
|
||
|
<td align="center" class="bdr_td"> <a href="javascript:void(0);" onclick="javascript:sendpage('files/<?php echo $thelist[$count]?>');"><img src='images/download.png' border="0" /></a></td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<?php $count++; } ?>
|
||
|
<tr class='bg2'>
|
||
|
<td ><div style="margin-right:10px; ">Page </div></td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td colspan="5" align="right">
|
||
|
<input type="button" onclick="window.location.href='upload.php?acn=add'" value="Upload File"></td>
|
||
|
<td>
|
||
|
|
||
|
|
||
|
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
</form>
|
||
|
<?php } ?>
|
||
|
</center>
|
||
|
</fieldset>
|
||
|
</td>
|
||
|
|
||
|
</tr>
|
||
|
</table></td>
|
||
|
</tr>
|
||
|
<?php include('footer.php'); ?>
|