uploadFile.aspx
上传用户:lanchensha
上传日期:2022-02-27
资源大小:7530k
文件大小:11k
源码类别:

编辑器/阅读器

开发平台:

C#

  1. <%@ Page Language="C#" AutoEventWireup="true" Inherits="DotNetTextBox.UpLoad"%>
  2. <%@ Import Namespace="DotNetTextBox" %>
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  6. <base target="_self" />
  7. <script language="javascript" type="text/javascript">
  8. var userAgent = navigator.userAgent.toLowerCase();
  9. var is_ie = (userAgent.indexOf('msie') != -1);
  10. var arr=new Array;
  11. function loading() 
  12. {
  13.     document.getElementById("loading").style.visibility="visible";
  14.     return true;
  15. }
  16. function reloadClick()
  17. {
  18. var reload=document.getElementById ("reload");
  19. reload.click();
  20. }
  21. function newFile()
  22. {
  23.     if(document.getElementById("file_path").value!="")
  24.     {
  25.     arr[0]=document.getElementById("file_path").value.replace(/s/g,"%20");
  26.     if(document.getElementById("file_name").value=="")
  27.     {
  28.     arr[1]=document.getElementById("file_path").value;
  29.     }
  30.     else
  31.     {
  32.     arr[1]=document.getElementById("file_name").value;
  33.     }
  34.     if(is_ie)
  35.     {
  36.     window.returnValue = arr;
  37.     }
  38.     else
  39.     {
  40.     if(document.getElementById("insertFile").value!='<%=ResourceManager.GetString("mof")%>')
  41.     {
  42.     window.opener.inserObject(null,'file',arr);
  43.     }
  44.     else
  45.     {
  46.     window.opener.inserObject(null,'modfile',arr);
  47.     }
  48.     }
  49.     }
  50.     window.close();
  51. }
  52. function add(name) 
  53. {
  54.     if(is_ie)
  55.     {
  56.     var path=document.getElementById("path").innerText;
  57.     }
  58.     else
  59.     {
  60.     var path=document.getElementById("path").textContent;
  61.     }
  62.     document.getElementById("file_path").value=path+name;
  63.     document.getElementById("file_path").focus();
  64. }
  65. var sTitle='<%=ResourceManager.GetString("insertfile")%>';
  66. if(is_ie)
  67. {
  68. if (dialogArguments!=null)
  69. sTitle='<%=ResourceManager.GetString("moffile")%>';
  70. }
  71. else
  72. {
  73. arr=window.opener.GetFile();
  74. if(arr[0]!=null)
  75. {
  76. sTitle='<%=ResourceManager.GetString("moffile")%>';
  77. }
  78. window.focus();
  79. }
  80. document.write("<TITLE>" + sTitle + "</TITLE>");
  81. </script>
  82. <link href="stylesheet.css" rel="stylesheet" type="text/css" />
  83. </head>
  84. <body topmargin="0">
  85.     <form id="uploadFace" runat="server">
  86.         <table border="0" align=center style="word-break:break-all" width="100%">
  87.             <tr>
  88.                 <td colspan="3" rowspan="3">
  89.                     <fieldset><legend><span style="color: darkgray"><span style="color: gray"><%=ResourceManager.GetString("uploadface")%></span>&nbsp;
  90.                     </span></legend>
  91.         <%=ResourceManager.GetString("uploadpath")%>:<asp:Label ID="path" runat="server" ForeColor="Black"></asp:Label><br />
  92.         <%=ResourceManager.GetString("uploadfiles")%>:<asp:FileUpload ID="FileUpload1" runat="server" Width="388px" Height="21px" TabIndex="2" Font-Size="10pt" />
  93.         <asp:Button ID="uploadBtn" runat="server" OnClientClick="loading()" OnClick="UploadBtn_Click"/><br />
  94.         <%=ResourceManager.GetString("filepath")%>:<asp:TextBox ID="file_path" runat="server" Width="316px" TabIndex="1"></asp:TextBox>
  95.         <input language="javascript" onclick="javascript:newFile()" type="button" value='<%=ResourceManager.GetString("insertfile")%>' id="insertFile" /><br />
  96.                         <%=ResourceManager.GetString("filetitle")%>:<asp:TextBox ID="file_name" runat="server" Width="316px"></asp:TextBox>&nbsp;<br />
  97.                         [ <%=ResourceManager.GetString("uploaduse")%>:<asp:label ID="useSpace" ForeColor="Red" runat=server />,<%=ResourceManager.GetString("have")%>:<asp:label ID="space" ForeColor="Red" runat=server /><%=ResourceManager.GetString("singlesize")%>:<asp:Label ID="maxSingleUploadSize" runat="server" ForeColor="Red"></asp:Label>
  98.                         ]</fieldset>
  99.                     <fieldset style="text-align: center"><legend><span style="color: darkgray"><span style="color: gray"><%=ResourceManager.GetString("filelist")%></span>&nbsp;
  100.                     </span></legend>
  101.         <div id="fileshow" style="border-right: 1.5pt inset; border-top: 1.5pt inset; vertical-align: middle;
  102.             overflow: auto; border-left: 1.5pt inset; width: 100%; border-bottom: 1.5pt inset;
  103.             height: 240px; background-color: white">
  104. <asp:GridView runat="server" id="File_List" HeaderStyle-HorizontalAlign=Center AutoGenerateColumns="False" HeaderStyle-BackColor="buttonface" HeaderStyle-ForeColor=windowtext Width="100%" BorderWidth="1px" OnRowCancelingEdit="File_List_RowCancelingEdit" OnRowUpdating="File_List_RowUpdating">
  105.   <Columns>
  106.   <asp:TemplateField>
  107.         <HeaderTemplate>
  108.                 <asp:CheckBox ID="checkall" runat="server" Text=<%#ResourceManager.GetString("selectall")%> AutoPostBack="true" OnCheckedChanged="checkAll" />
  109.          </HeaderTemplate>
  110.           <ItemTemplate>
  111.                    <asp:CheckBox ID="check" runat="server" />
  112.             </ItemTemplate>     
  113.             <ItemStyle HorizontalAlign="Center" Width="55px" />
  114. </asp:TemplateField>
  115.     <asp:TemplateField>
  116.     <EditItemTemplate>
  117.     <asp:TextBox ID="editName" Text=<%#DataBinder.Eval(Container.DataItem,"Name").ToString().Remove(DataBinder.Eval(Container.DataItem,"Name").ToString().LastIndexOf(DataBinder.Eval(Container.DataItem,"Extension").ToString()))%> Width="100px" runat=server></asp:TextBox> <asp:Button ID="editBtn" CommandName="Update" CommandArgument=<%#DataBinder.Eval(Container.DataItem,"Name")%> runat=server Text=<%#ResourceManager.GetString("edit")%> /> <asp:Button ID="Cancel" runat=server Text=<%#ResourceManager.GetString("cancel")%> CommandName="Cancel" />
  118.     </EditItemTemplate>
  119.     <ItemTemplate>
  120.     <img src="img/filetype/<%#DataBinder.Eval(Container.DataItem,"Attributes").ToString().ToLower()=="directory"?"folder":((string)DataBinder.Eval(Container.DataItem,"Extension")).Replace(".","")%>.gif" /><asp:Label ID="ListID" Text=<%#DataBinder.Eval(Container.DataItem,"Name")%> style="cursor:pointer; word-break:break-all" onmouseover="this.style.textDecoration='underline'" onmouseout="this.style.textDecoration='none'" onclick=<%#DataBinder.Eval(Container.DataItem,"Name","javascript:add("{0}")")%> runat=server />
  121.     </ItemTemplate>
  122.     </asp:TemplateField>
  123.     <asp:BoundField DataField="LastWriteTime" ReadOnly="True" HtmlEncode=False DataFormatString="{0:D}" >
  124.         <ItemStyle HorizontalAlign="Center" Width="25%" />
  125.     </asp:BoundField>
  126.     <asp:BoundField DataField="Length" ReadOnly="True" HtmlEncode=False DataFormatString="{0:#,### Bytes}" >
  127.         <ItemStyle HorizontalAlign=Center Width="25%" />
  128.     </asp:BoundField>
  129.   </Columns>
  130. <HeaderStyle ForeColor="WindowText" BackColor="Control" BorderWidth="1px" HorizontalAlign="Center" />
  131. </asp:GridView></div><table width="100%" border="0px"><tr><td>
  132.     [<%=ResourceManager.GetString("controlmenu")%>]:<asp:button id="selectAllBtn" runat="server"  borderstyle="Dashed" onclick="selectAllBtn_Click"></asp:button>
  133.     <asp:Button ID="deleteBtn" runat="server" BorderStyle="Dashed" OnClick="deleteBtn_Click" />&nbsp;<asp:button id="editBtn" runat="server" borderstyle="Dashed" onclick="editBtn_Click" ></asp:button>
  134.     <input language="javascript" onclick="if(is_ie){showModalDialog('find.aspx',this,'dialogWidth:320px;dialogHeight:130px;status:0;scroll:no');}else{window.find();}" type="button" value="<%=ResourceManager.GetString("findfile")%>" />
  135.     <input language="javascript" onclick="window.close();" type="button" value="<%=ResourceManager.GetString("close")%>" /><br /><a  href="#" onclick="if(is_ie){showModalDialog('Advanced.aspx',window,'dialogWidth:800px;dialogHeight:600px;status:0;scroll:yes');reload.click();}else{window.open('Advanced.aspx');}"><%=ResourceManager.GetString("advancedsetting")%></a><a id='reload' href='uploadfile.aspx' style='display:none'></a></td>
  136.     <td align="right">
  137.         <img border=0px src="img/logo_S.png" /></td>
  138. </tr></table>
  139.                         </fieldset>
  140.         <asp:HiddenField ID="config_watermark" runat="server" />
  141.         <asp:HiddenField ID="config_watermarkText" runat="server" />
  142.         <asp:HiddenField ID="config_watermarkImages" runat="server" />
  143.         <asp:HiddenField ID="config_watermarkImages_path" runat="server" />
  144.         <asp:HiddenField ID="config_smallImages" runat="server" />
  145.         <asp:HiddenField ID="config_smallImagesName" runat="server" />
  146.         <asp:HiddenField ID="config_maxAllUploadSize" runat="server" />
  147.         <asp:HiddenField ID="config_autoname" runat="server" />
  148.         <asp:HiddenField ID="config_allowUpload" runat="server" />
  149.         <asp:HiddenField ID="config_fileFilters" runat="server" />
  150.         <asp:HiddenField ID="config_maxSingleUploadSize" runat="server" />
  151.         <asp:HiddenField ID="config_fileListBox" runat="server" />
  152.         <asp:HiddenField ID="config_watermarkImagesName" runat="server" />
  153.         <asp:HiddenField ID="config_watermarkName" runat="server" />
  154.         <asp:HiddenField ID="config_smallImagesType" runat="server" />
  155.         <asp:HiddenField ID="config_smallImagesW" runat="server" />
  156.         <asp:HiddenField ID="config_smallImagesH" runat="server" />
  157.         <asp:HiddenField ID="config_type" Value="File"  runat="server" />
  158.                 </td>
  159.             </tr>
  160.         </table>
  161.         <div id="loading" style="border-right: #333333 1px dashed; border-top: #333333 1px dashed;
  162.                         font-size: 9pt; visibility:hidden; border-left: #333333 1px dashed;
  163.                         width: 270px; color: #000000; border-bottom: #333333 1px dashed; position: absolute; height: 120px; background-color: #ffffff">
  164.                         <center>
  165.                             <br />
  166.                             <br />
  167.                             <%=ResourceManager.GetString("loading")%></center>
  168.                         <br />
  169.                         <center>
  170.                             <asp:Button ID="canceloading" runat="server" Style="border-top-style: dashed; border-right-style: dashed;
  171.                                 border-left-style: dashed; border-bottom-style: dashed" />&nbsp;</center>
  172.                         <br />
  173.                     </div>
  174.         <script type="text/javascript">
  175. var load=document.getElementById('loading');
  176. window.onload=function(){resizeLoad()};
  177. function resizeLoad()
  178. {
  179. load.style.top = parseInt((document.body.clientHeight-load.offsetHeight)/2+document.body.scrollTop);
  180. load.style.left = parseInt((document.body.clientWidth-load.offsetWidth)/2+document.body.scrollLeft);
  181. }
  182. if(is_ie)
  183. {
  184. document.body.bgColor="ButtonFace";
  185. if (dialogArguments!=null)
  186. {
  187. document.getElementById("file_path").value=dialogArguments[0];
  188. document.getElementById("file_name").value=dialogArguments[1];
  189. document.getElementById("insertFile").value='<%=ResourceManager.GetString("mof")%>';
  190. }
  191. }
  192. else
  193. {
  194. document.body.bgColor="#E0E0E0";
  195. if(arr[0]!=null)
  196. {
  197. document.getElementById("file_path").value=arr[0];
  198. document.getElementById("file_name").value=arr[1];
  199. document.getElementById("insertFile").value='<%=ResourceManager.GetString("mof")%>';
  200. }
  201. }
  202. </script>      
  203. </form>
  204. </body>
  205. </html>