<?php
 require '../Run.php';
 require '../include/class/file.class.php';
 echo head('文件上传');
 ?>
<style>
.upload{
		min-width:240px;
		margin-bottom:5px;
	    border:1px solid #ccc;
		width:80%;
		margin-left:auto;
		margin-right:auto;
		overflow:hidden;
   }
.upload tr td{
	height:35px;
	background-color:#fff;
	}
.upload tr td input{
	height:33px;
	background-color:#fff;
	border:none;
	width:99%;
	}
.upload tr td textarea{
	height:66px;
	background-color:#fff;
	border:none;
	width:100%;
	}
.upload tr td.text{
	height:33px;
	background-color:#fff;
	border:none;
	color:#ccc;
	font-size:14px;
	line-height:35px;
	width:80px;
	text-align:center;
	}
</style>
<?php
if($_POST['act'] == 'upload'){
$allowtype = array("png","jpeg","jpg","gif","JPEG","PNG","GIF","JPG");
$path = 'file/'.WAPID.'/'.MYID.'_'.$xid;
$uploads = new file($path,$allowtype);
$upload = $uploads -> upfile();
foreach($upload as $value)
{
	if($value != 'NULL'){
		echo '<div class="tip">';
		echo '上传成功';
		echo '</div>';
		$filearr[] = $path.'/'.$value;
	}
}
	$files = implode('|',$filearr);
	mysql_query('INSERT INTO `download` (`siteid`, `gro`, `title`, `file_path`, `file_ver`, `file_time`, `file_end`, `file_content`, `file_v`, `file_down`, `file_pic`, `file_auter`, `file_lan`, `file_pt`,`shenhe`,`spic`) VALUES (\''.WAPID.'\', \''.$_GET['cid'].'\', \''.$_POST['title'].'\', \''.$files.'\', \''.$_POST['file_ver'].'\', \''.time().'\', \''.$_POST['file_end'].'\', \''.$_POST['file_content'].'\', \'0\', \'0\', \'0\', \''.$id.'\', \''.$_POST['file_lan'].'\', \''.$_POST['file_pt'].'\',\'0\',\''.$spic.'\');');
	echo '<div class="mylink"><a href="?cid='.$_GET['cid'].'">返回上传</a>|<a href="list.php?upload='.$_GET['upload'].'&cid='.$_GET['cid'].'">文件列表</a></div>';
}else{
?>
<div class="title">下载文件上传<a href="upload.php?cid=<?php echo $_GET['cid']; ?>">远程上传</a></div>
<form  enctype="multipart/form-data" method="post" action="?cid=5">

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="upload">
  <tr>
    <td class="text">文件名</td>
    <td><input name="title" type="text" value=""></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="upload">
  <tr>
      <td class="text">版本号</td>
    <td><input name="file_ver" type="text" value="" id="file_lan"></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="upload">
  <tr>
      <td class="text">更新时间</td>
    <td><input name="file_end" type="text" value="" id="file_lan"></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="upload">
  <tr>
  
      <td class="text">国家/语言</td>
    <td><input name="file_lan" type="text" value="" id="file_lan"></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="upload">
  <tr>
      <td class="text">支持平台</td>
    <td><input name="file_pt" type="text" value="" id="file_pt"></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="upload">
  <tr>
    <td class="text">软件简介</td></tr><tr>
    <td><textarea name="file_content"></textarea></td>
  </tr>
</table>


<table width="100%" border="0" cellspacing="0" cellpadding="0" class="upload">
  
  <?php
	$nums = $_GET['nums'] == 0 ||$_GET['nums'] == null ? 1:$_GET['nums'];
    for($i=0;$i<$nums;$i++)
	{
	$is = $i + 1;
	echo "<tr>\n<td class=\"text\">\n源文件".$is."\n</td>\n
    <td>\n<input name=\"userfile".$is."\" type=\"file\"/>\n</td>\n</tr>";
	}
	?></table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="upload">
  <tr>
    <td class="text">图片标识（100*100左右）</td>
    <td><input name="spic1" type="file"/></td>
  </tr>
</table>
<!--隐藏表单-->
<input type="hidden" name="act" value="upload">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="upload">
  <tr>
  <td class="text">上传软件</td>
    <td style="background-color:#328cc9;"><input type="submit" style="background-color:#328cc9;" value="立刻上传" id="file_lan"></td>
  </tr>
</table></form>
<div class="mylink">
<a href="list.php?cid=5&">返回上级</a>|
<a href="../index.php?">网站首页</a>
</div><?php
}
echo footer(1);
?>