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