<%@ Page language="c#" Codebehind="uploadS.aspx.cs" AutoEventWireup="True" Inherits="Webdisk.uploadS" %>
<%@ Register TagPrefix="Upload" Namespace="Mytaoyuan.Com.Upload" Assembly="Mytaoyuan.Com.Upload" %>
<%@ Register TagPrefix="uc" TagName="uc1" Src="~/Top.ascx" %>
<%@ Register TagPrefix="uc" TagName="uc2" Src="bottom.ascx" %>
<% @ Import Namespace="Webdisk" %>
<!DOCTYPE HTML>
<HTML>
  <HEAD>
    <title>上传文件</title>
	<link href="<%=xml.GetStyle()%>" type=text/css rel=stylesheet>
    <link href="css/common.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
      <script src="js/base64.js" type="text/javascript"></script>
<script language=javascript>
function getUrlParam(paramName){	
	var s=location.search;
	if(s!=null){
	var sarr=s.substr(1).split("&");
	var tarr;
	for(i=0;i<sarr.length;i++){
	tarr=sarr[i].split("=");
	if(tarr.length==2&&tarr[0].toLowerCase()==paramName){
	return tarr[1];
	}
	}
	return "";
	}
}
	  function setid()
	  {
	  	if (document.all.type1.style.display=='')
		{
		  str='';
		  if(!document.form1.upcount.value)
		   document.form1.upcount.value=1;
		   if (document.form1.upcount.value>20)
		   {
				alert('上传数目不能大于20！');
				return false;
		   }
		   var tmp="";
		   if (getUrlParam('path')!=null) tmp+="&path="+getUrlParam('path');
		   if (getUrlParam('code')!=null) tmp+="&code="+getUrlParam('code');
		   if (getUrlParam('out')!=null) tmp+="&out="+getUrlParam('out');
		   if (getUrlParam('rtn')!=null) tmp+="&rtn="+getUrlParam('rtn');
		   window.location='uploads.aspx?count='+document.form1.upcount.value+tmp;
		 }
		 else
		 {
		  str='';
		  if(!document.form1.upcount.value)
		   document.form1.upcount.value=1;
		   if (document.form1.upcount.value>20)
		   {
				alert('添加数目不能大于20！');
				return false;
		   }
		  for(i=1;i<=document.form1.upcount.value;i++)
			 str+='下载地址：<INPUT class=kuan id=textBoxFileURL type=text name=textBoxFileURL size=52>&nbsp;&nbsp;文件描述：<input id=note2 name=note2 type=text class=kuan size=30><br>';
		  document.getElementById("upid2").innerHTML=str+'<br>';
		 }
	  }
	  function filenote()
	  {
		var valueStr = "";
		var inputs = document.getElementsByTagName("input");
		for(var i = 0; i < inputs.length; i++)
		{
			
		if(inputs[i].name == "note")
		{
		valueStr += inputs[i].value + ",";
		}
		}
		document.all.hidurl.value=valueStr;
	  }
	  function outlink()
	  {
		var valueStr = "";
		var inputs = document.getElementsByTagName("input");
		for(var i = 0; i < inputs.length; i++)
		{
			
		if(inputs[i].name == "url")
		{
		valueStr += inputs[i].value + ",";
		}
		}
		document.all.hidurl.value=valueStr;
	  }
	  function show1()
	  {
	  	document.all.type1.style.display='';
		document.all.type2.style.display='';
		document.all.type5.style.display='none';
		document.all.type6.style.display='none';
	  }
	  function show2()
	  {
	  	document.all.type1.style.display='none';
		document.all.type2.style.display='none';
		document.all.type5.style.display='none';
		document.all.type6.style.display='none';
	  }
	  function show3()
	  {
	  	document.all.type1.style.display='none';
		document.all.type2.style.display='none';
		document.all.type5.style.display='';
		document.all.type6.style.display='';
	  }
function EditOpt()
{
	Webdisk.upload.EditOpt(document.all.autorename.checked);
}
			</script>

<style type=text/css>.STYLE1 { COLOR: #0000ff }
	.ProgressBar { BORDER-RIGHT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: 0px; WIDTH: 100%; PADDING-TOP: 0px; BORDER-BOTTOM: 0px; HEIGHT: 3em }
	</style>
</HEAD>
<body>
<!-- Header Start -->
        <uc:uc1 ID="top" runat="server" />
<!-- Header End -->
    <div style="text-align:center;margin:auto;width:1000px;">
<form id=form1 method=post runat="server"><FONT face=宋体></FONT><br>
<TABLE cellSpacing=0 cellPadding=0 width="98%" align=center>
  <TR>
    <TD width=5 background=pics/wenbenkuan_02.gif><IMG height=5 src="pics/wenbenkuan_01.gif" width=5 ></TD>
    <TD width=874 background=pics/wenbenkuan_02.gif><IMG height=5 src="pics/wenbenkuan_02.gif" width=5 ></TD>
    <TD><IMG height=5 src="pics/wenbenkuan_03.gif" width=5 ></TD></TR>
  <TR>
    <TD background=pics/wenbenkuan_04.gif>&nbsp;</TD>
    <TD class=tablebg background=pics/wenbenkuan_05.gif>
      <TABLE width="100%">
        <TR>
          <TD class=tabletop width="100%"><IMG src="pics/pick.gif" align=absMiddle > 上传文件&nbsp;&nbsp;&nbsp;&nbsp;<A href="javascript:history.go(-1);" ><IMG src="pics/link_back.gif" align=absMiddle border=0 ></A></TD></TR>
        <TR class=tablebg>
          <TD>
            <TABLE cellSpacing=0 cellPadding=4 width="100%" border=0 
            >
              <TBODY>
              <TR>
                <TD>
                  <H4>路径:  <asp:label id=txtpath runat="server"></asp:label></H4>
                  <div class="tip" id="dlock" runat="server"><img src="pics/tip.gif" align="absMiddle">&nbsp;当前为上传码上传文件，由于您已登录，可以<asp:LinkButton id=btnselcode runat="server" Font-Underline="True" ForeColor="Black" onclick="btnselcode_Click">直接选择自己空间内文件复制到上传码目录</asp:LinkButton><br>
                  </div>
                  <asp:CheckBox ID="cbIsEncrypt" runat="server" Text="是否加密" Checked="false" OnCheckedChanged="showdpLevel" AutoPostBack="true" Visible="false" /><asp:label Visible="false" id="lbLevel" runat="server" Text="加密等级:"></asp:label>
                  <asp:DropDownList ID="dpLevel" runat="server" Visible="false" AutoPostBack=true></asp:DropDownList>
                  <br />
                  类型： 
                  <input id=click1 onclick=show1() type=radio CHECKED value=1 
                  name=optshow> <label for=click1 
                  >上传文件</label> <input id=click3 
                  onclick=show3() type=radio value=2 name=optshow 
                  > <label for=click3 
                  >外部下载</label> <BR 
                  >需上传的个数 : <input class=kuan id=upcount 
                  type=text size=7 value=5 name=upcount> <input class=kuan onclick=setid(); type=button value=" 设 定 " name=Button> 
                  <INPUT id=autorename type=checkbox CHECKED name=autorename 
                   runat="server" onChange="EditOpt();"> <label for=autorename 
                  ><span class=STYLE1 
                  >重名文件自动更名</span></label> <BR 
                  ></TD></TR>
              <TR id=type1>
                <TD id=upid>
                  <P><UPLOAD:INPUTFILE id=UpLoad1 runat="server" CssClass="kuan" Width="400px"></UPLOAD:INPUTFILE>&nbsp;&nbsp;文件描述：<input name=note type=text 
                  class=kuan size="30">
                  <br><asp:placeholder id=Panel1 
                   
              runat="server"></asp:placeholder></P></TD></TR>
              <TR id=type2>
                <TD>
                  <table width="100%" border=0>
                    <tr>
                      <td><UPLOAD:PROGRESSBAR 
                        id=inlineProgressBar runat="server" 
                        inline="true" 
                      Triggers="btn_upload"></UPLOAD:PROGRESSBAR></td></tr>
                    <tr>
                      <td width="31%"><INPUT class=btn id=btn_upload type=button value=" 上 传 " name=btn_upload runat="server" onserverclick="btn_upload_ServerClick" onclick="return btn_upload_onclick()"> 
                        &nbsp; <INPUT class=btn id=btn_return onclick=javascript:history.go(-1); type=button value=" 返 回 " name=btn_return> 
<asp:label id=notype runat="server"></asp:label><INPUT 
                        id=Hidpath2 type=hidden size=1 name=Hidpath 
                         runat="server"></td></tr></table>
                  <p><A href="javascript:ActiveUpload()"><font 
                  color=#ff0000 
                  >点击这里使用浏览器插件上传（可选择多文件同时上传，支持大文件和断点续传）</font></A> 
                  <INPUT id=maxsize type=hidden name=maxsize 
                   runat="server"> 
                  <input id=hidurl type=hidden name=hidurl 
                  runat="server">
                  </p>
                  <p></p></TD></TR>
              <TR id=type5 style="DISPLAY: none">
                <TD id=upid2>
                  <P>下载地址：<INPUT class=kuan 
                  id=textBoxFileURL type=text size=52 name=textBoxFileURL 
                   runat="server">&nbsp;&nbsp;文件描述：<input id=note2 name=note2 type=text class=kuan size="30">
</P></TD></TR>
              <TR id=type6 style="DISPLAY: none">
                <TD><INPUT class=btn id=progressStartButton onclick=StartEverything(this); type=button value=" 下 载 " name=progressStartButton> 
                  &nbsp;<INPUT class=btn id=btn_return2 onclick=javascript:history.go(-1); type=button value=" 返 回 " name=btn_return1> 
                  （填写外部要下载到空间中的文件地址，为直接下载地址，如：http://www.xxx.com/xxx.zip） 
                  <p>
                  <p><asp:literal id=progressVariables 
                   runat="server"></asp:literal></p>
                  <div id=progressNotices 
                  style="FONT-WEIGHT: bold; FONT-SIZE: 12px; FONT-FAMILY: Verdana; HEIGHT: 14px" 
                  ></div>
                  <div id=progressBarArea style="DISPLAY: none" 
                  >
                  <div 
                  style="BORDER-RIGHT: gray 1px inset; PADDING-RIGHT: 1px; BORDER-TOP: gray 1px inset; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; MARGIN: 14px; BORDER-LEFT: gray 1px inset; PADDING-TOP: 1px; BORDER-BOTTOM: gray 1px inset" 
                  ><FONT face=宋体></FONT>
                  <div id=progressBar 
                  style="WIDTH: 0%; COLOR: navy; HEIGHT: 22px; BACKGROUND-COLOR: navy" 
                  ></div></div><asp:literal id=progressAlert 
                   
                  runat="server"></asp:literal></div><iframe id=progressIFrame 
                  style="POSITION: absolute" name=progressIFrame 
                  src="about:blank" frameBorder=0 width=0 scrolling=no 
                  height=0></iframe>
                  <DIV></DIV>
            <DIV 
        ></DIV></TD></TR></TBODY></TABLE></TD></TR></TABLE></TD>
    <TD width=5 background=pics/wenbenkuan_06.gif><IMG height=5 src="pics/wenbenkuan_06.gif" width=5 ></TD></TR>
  <TR>
    <TD background=pics/wenbenkuan_08.gif><IMG height=5 src="pics/wenbenkuan_07.gif" width=5 ></TD>
    <TD background=pics/wenbenkuan_08.gif><IMG height=5 src="pics/wenbenkuan_08.gif" width=5 ></TD>
    <TD><IMG height=5 src="pics/wenbenkuan_09.gif" width=5 ></TD></TR>
    </TABLE>
    </form>
    </div>
    <!-- Footer Start -->
            <uc:uc2 ID="bootom" runat="server" />
    <!-- Footer End -->
<script language=javascript>
    function ActiveUpload() {
        var url = encode64("uploadA.aspx<%=outstr%>");
        window.location = "indexPage.aspx?p="+url;
    }
	function getUrlParam(paramName){	
		var s=location.search;
		if(s!=null&&s.length>1){
		var sarr=s.substr(1).split("&");
		var tarr;
		for(i=0;i<sarr.length;i++){
		tarr=sarr[i].split("=");
		if(tarr.length==2&&tarr[0].toLowerCase()==paramName){
		return tarr[1];
		}
		}
		return null;
		}
	}
	function StartEverything(callingButton){
		if (document.getElementById('progressStartButton').value ==' 停 止 ')
		{
			document.getElementById('progressStartButton').value =' 下 载 ';
			document.getElementById('progressNotices').innerHTML='';
			document.getElementById('progressBarArea').style.display = 'none';
			window.frames['progressIFrame'].location.href = 'about:blank';
		}
		else
		{
			document.getElementById('progressNotices').innerHTML='正在处理，请稍候……';
			window.frames['progressIFrame'].location.href = UniqueUrl(AppendArgument("downworker.aspx"));
		}
	}
	var objMessage = null;
	var objBar = null;
	var maxReached = false;
	function SetProgress(percentage, message){
		if(percentage <= 100){
			if(objMessage == null){
				objMessage = document.getElementById('progressNotices');
			}
			if(objBar == null){
				objBar = document.getElementById('progressBar');
			}
			if(message != null && message != ''){
				objMessage.innerHTML = message;
			}
			if(percentage > 0){
				objBar.innerHTML = '.';
			}else{
				objBar.innerHTML = '';
			}
			objBar.style.width = percentage.toString() + '%';
			if(percentage == 100){
				SetDisplay(false);
			}
		}else{
			maxReached = true;
		}
	}
	function SetDisplay(progressIsRunning){
		var progressBarArea = document.getElementById('progressBarArea');
		progressBarArea.style.display = (progressIsRunning ? 'block' : 'none');
		document.getElementById('progressStartButton').value = (progressIsRunning ? ' 停 止 ' : ' 下 载 ');
	}
	function Say(message){
		if(message == null || message == ''){
			message = '(null)';
		}
		alert(message);
	}
	function AppendArgument(url){
		if(url.indexOf('?') > 0){
			url += '&';
		}else{
			url += '?';
		}
		url += "file";
		var argValue = '';
		var argNote='';
		var inputs = document.getElementsByTagName("input");
		for(var i = 0; i < inputs.length; i++)
		{
			if(inputs[i].id == "textBoxFileURL") argValue += inputs[i].value + ",";
			if(inputs[i].id == "note2") argNote += inputs[i].value + ",";
		}
		if(argValue != null && argValue != ''){
			if(url.indexOf('=') != (url.length - 1)){
				url += '=';
			}
			url += escape(argValue);
		}
		else
		{
			alert('请输入下载文件的外部地址！');
			return;
		}
		url +='&path='+getUrlParam('path');
		url += '&note='+escape(argNote);
		if (getUrlParam('out')!=null) url +='&out='+getUrlParam('out');
		if (document.all.autorename.checked) url +='&auto=1';
		SetDisplay(true);
		return url;
	}
	function UniqueUrl(url){
		var randomNum, uniqifier;
		if(url == null || url == ''){
			url = 'UrlUndefined';
		}else if(url.indexOf('Unique') > 0){
			randomNum = Math.random();
			url = ReplaceArgumentValue(url, 'Unique', randomNum.toString().substr(2));
		}else{
			randomNum = Math.random();
			uniqifier = 'Unique=' + randomNum.toString().substr(2);
			if(url.indexOf('?') > 0){
				url += '&' + uniqifier;
			}else{
				url += '?' + uniqifier;
			}
		}
		return url;
	}
	function ReplaceArgumentValue(searchArgs, argName, newArgValue){
		var newSearchArgs;
		argName += '=';
		var indexStart = searchArgs.indexOf(argName);
		if(indexStart >= 0){
			var indexEnd = searchArgs.indexOf('&', indexStart);
			newSearchArgs = searchArgs.substr(0, indexStart + argName.length);
			newSearchArgs += newArgValue;
			if(indexEnd > indexStart){
				newSearchArgs += searchArgs.substr(indexEnd);
			}
			return newSearchArgs;
		}else{
			return searchArgs;
		}
	}

</script>

	</body>
</HTML>
