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

编辑器/阅读器

开发平台:

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 image = new Array;
  11. var w,h;
  12. function reloadClick()
  13. {
  14. var reload=document.getElementById ("reload");
  15. reload.click();
  16. }
  17. function changeWaterMark(type)
  18. {
  19. if(type=='watermark')
  20. {
  21. if(document.getElementById("watermark").checked)
  22. {
  23. document.getElementById("watermarkText").checked=false;
  24. document.getElementById("config_watermark").value="false";
  25. document.getElementById("config_watermarkImages").value="true";
  26. }
  27. else
  28. {
  29. document.getElementById("config_watermarkImages").value="false";
  30. }
  31. }
  32. else
  33. {
  34. if(document.getElementById("watermarkText").checked)
  35. {
  36. document.getElementById("watermark").checked=false;
  37. document.getElementById("config_watermark").value="true";
  38. document.getElementById("config_watermarkImages").value="false";
  39. }
  40. else
  41. {
  42. document.getElementById("config_watermark").value="false";
  43. }
  44. }
  45. }
  46. function loading() 
  47. {
  48.     document.getElementById("loading").style.visibility="visible";
  49.     return true;
  50. }
  51. function checksize(str,type)
  52. {
  53.     if(type=="wedth"&document.getElementById("ImgWidth").value!=""&document.getElementById("ImgHeight").value!="")
  54.     {
  55.        if(w!=null&&h!=null)
  56.        {
  57.        document.getElementById("ImgHeight").value=Math.round((parseInt(str)*h)/w);
  58.        }
  59.        else
  60.        {
  61.        w=str;
  62.        h=document.getElementById("ImgHeight").value;
  63.        }
  64.     }
  65.     else if(document.getElementById("ImgWidth").value!=""&document.getElementById("ImgHeight").value!="")
  66.     {
  67.        if(w!=null&&h!=null)
  68.        {
  69.        document.getElementById("ImgWidth").value=Math.round((parseInt(str)*w)/h);
  70.        }
  71.        else
  72.        {
  73.        w=document.getElementById("ImgWidth").value;
  74.        h=str;
  75.        }
  76.     }
  77. }
  78. function preview(name) 
  79. {
  80.     
  81.     if(is_ie)
  82.     {
  83.     var path=document.getElementById("path").innerText;
  84.     }
  85.     else
  86.     {
  87.     var path=document.getElementById("path").textContent;
  88.     }
  89.     document.getElementById("file_path").value=path+name;
  90.     document.getElementById("previewImg").innerHTML='<img src='+document.getElementById("file_path").value.replace(/s/g,"%20")+' align="middle" onload="ImgWidth.value=this.width;ImgHeight.value=this.height;w=this.width;h=this.height;if(this.width>300){this.width=300;this.height=Math.round(this.width*h/w);}if(this.height>225){this.height=225;this.width=Math.round(this.height*w/h);}" />';
  91.     document.getElementById("file_path").focus();
  92. }
  93. function newImages() 
  94. {
  95.     if(document.getElementById("file_path").value!="")
  96.     {
  97.     var arr=new Array;
  98.     arr[0]=document.getElementById("file_path").value.replace(/s/g,"%20")
  99.     arr[1]=document.getElementById("ImgWidth").value;
  100.     arr[2]=document.getElementById("ImgHeight").value;
  101.     arr[3]=document.getElementById("ImgAlt").value;
  102.     arr[4]=document.getElementById("Imgalign").value;
  103.     if(is_ie)
  104.     {
  105.     window.returnValue = arr;
  106.     }
  107.     else
  108.     {
  109.     if(document.getElementById("insertImg").value!='<%=ResourceManager.GetString("mof")%>')
  110.     {
  111.     window.opener.inserObject(null,'img',arr);
  112.     }
  113.     else
  114.     {
  115.     window.opener.inserObject(null,'modimg',arr);
  116.     }
  117.     }
  118.     }
  119.     window.close();
  120. }
  121. var sTitle='<%=ResourceManager.GetString("insertimages")%>';
  122. if(is_ie)
  123. {
  124. if (dialogArguments!=null)
  125. sTitle='<%=ResourceManager.GetString("mofimages")%>';
  126. }
  127. else
  128. {
  129. image=window.opener.GetImg();
  130. if(image[0]!=null)
  131. {
  132. sTitle='<%=ResourceManager.GetString("mofimages")%>';
  133. }
  134. window.focus();
  135. }
  136. document.write("<TITLE>" + sTitle + "</TITLE>");
  137. </script>
  138. <link href="stylesheet.css" rel="stylesheet" type="text/css" />
  139. </head>
  140. <body topmargin="0">
  141.     <form id="uploadFace" runat="server">
  142.         <table border="0" align="center" style="word-break:break-all" width="100%">
  143.             <tr>
  144.                 <td colspan="4" rowspan="1" valign="top" style="width: 840px">
  145.                     <fieldset><legend><span style="color: gray"><%=ResourceManager.GetString("uploadface")%></span>&nbsp;</legend>
  146.         <%=ResourceManager.GetString("uploadpath")%>:<asp:Label ID="path" runat="server" ForeColor="Black"></asp:Label><br />
  147.         <%=ResourceManager.GetString("uploadimages")%>:<asp:FileUpload ID="FileUpload1" runat="server" Width="388px" Height="21px" TabIndex="2" Font-Size="10pt" /><asp:Button ID="uploadBtn" runat="server" OnClientClick="loading()" OnClick="UploadBtn_Click"/><asp:TextBox ID="remoteurl" runat="server" Visible="False" Text="http://" Width="350px"></asp:TextBox>
  148.                         <asp:Button ID="remoteupload" runat="server" Visible="False" Width="49px" OnClientClick="loading()" OnClick="remoteupload_Click" /><br />
  149.         <%=ResourceManager.GetString("filepath")%>:<asp:TextBox ID="file_path" runat="server" Width="316px" TabIndex="1"></asp:TextBox>
  150.         <input language="javascript" onclick="javascript:newImages()" type="button" value='<%=ResourceManager.GetString("insertimage")%>' id="insertImg" /><br />
  151.                         <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" RepeatDirection="Horizontal" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
  152.                             <asp:ListItem Selected=True Value="local" />
  153.                             <asp:ListItem Value="remote" />
  154.                         </asp:RadioButtonList>[ <%=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>
  155.     ]</fieldset>
  156.                     <fieldset style="text-align: center"><legend><span style="color: gray"><%=ResourceManager.GetString("filelist")%></span>&nbsp;</legend>
  157.         <div style="border-right: 1.5pt inset; border-top: 1.5pt inset; vertical-align: middle;
  158.             overflow: auto; border-left: 1.5pt inset; width: 100%; border-bottom: 1.5pt inset;
  159.             height: 240px; background-color: white">
  160. <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">
  161.   <Columns>
  162.   <asp:TemplateField>
  163.         <HeaderTemplate>
  164.                 <asp:CheckBox ID="checkall" runat="server" Text=<%#ResourceManager.GetString("selectall")%> AutoPostBack="true" OnCheckedChanged="checkAll" />
  165.          </HeaderTemplate>
  166.           <ItemTemplate>
  167.                    <asp:CheckBox ID="check" runat="server" />
  168.             </ItemTemplate>     
  169.             <ItemStyle HorizontalAlign="Center" Width="55px" />
  170. </asp:TemplateField>
  171.     <asp:TemplateField>
  172.     <EditItemTemplate>
  173.     <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" />
  174.     </EditItemTemplate>
  175.     <ItemTemplate>
  176.     <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" onmouseout="this.style.textDecoration='none'" onmouseover="this.style.textDecoration='underline'" onclick=<%#DataBinder.Eval(Container.DataItem,"Name","javascript:preview("{0}")")%>  runat=server />
  177.     </ItemTemplate>
  178.     </asp:TemplateField>
  179.     <asp:BoundField DataField="LastWriteTime" ReadOnly="True" HtmlEncode=False DataFormatString="{0:D}" >
  180.         <ItemStyle HorizontalAlign="Center" Width="25%" />
  181.     </asp:BoundField>
  182.     <asp:BoundField DataField="Length" ReadOnly="True" HtmlEncode=False DataFormatString="{0:#,### Bytes}" >
  183.         <ItemStyle HorizontalAlign=Center Width="25%" />
  184.     </asp:BoundField>
  185.   </Columns>
  186. <HeaderStyle Font-Bold="True" ForeColor="WindowText" BackColor="Control" BorderWidth="1px" HorizontalAlign="Center" />
  187. </asp:GridView></div>
  188.                 <fieldset><legend><span style="color: dimgray"><span style="color: gray"><%=ResourceManager.GetString("imagepreview")%></span>&nbsp;</span></legend>
  189.                     <table height="100%" width="100%">
  190.                         <tr>
  191.                             <td colspan="3" rowspan="3" style="height: 252px">
  192.                                 <div style="border-right: 1.5pt inset; padding-right: 0px; border-top: 1.5pt inset;
  193.                                     padding-left: 0px; padding-bottom: 0px; vertical-align:middle; overflow: auto;
  194.                                     border-left: 1.5pt inset; width: 320px; padding-top: 2px; border-bottom: 1.5pt inset;
  195.                                     height: 235px; background-color: white">
  196.                                     <div id="previewImg" align="center" style="background-color: white">
  197.                                     </div>
  198.                                 </div></td>
  199.                             <td colspan="1" rowspan="3" valign="top" style="height: 252px"><%=ResourceManager.GetString("width")%>:<input id="ImgWidth" style="width: 97px" onblur="if(document.getElementById('checkimgsize').checked){checksize(this.value,'wedth');}" type="text" maxlength="10" /><br />
  200.                                 <br />
  201.                                 <%=ResourceManager.GetString("height")%>:<input id="ImgHeight" style="width: 97px" type="text" onblur="if(document.getElementById('checkimgsize').checked){checksize(this.value,'height');}" maxlength="10" /><br /><input id="checkimgsize" type="checkbox" checked="CHECKED" />&nbsp;<%=ResourceManager.GetString("keepratio")%><br />
  202.                                 <%=ResourceManager.GetString("alt")%>:<input id="ImgAlt" style="width: 97px" type="text" maxlength="100" /><br />
  203.                                 <br />
  204.                                 <%=ResourceManager.GetString("align")%>:<select id="Imgalign" style="width: 97px">
  205.                                     <option selected="selected" value=""><%=ResourceManager.GetString("default")%></option>
  206.                                     <option value="left"><%=ResourceManager.GetString("left")%></option>
  207.                                     <option value="center"><%=ResourceManager.GetString("center")%></option>
  208.                                     <option value="right"><%=ResourceManager.GetString("right")%></option>
  209.                                 </select><br />
  210.                                 <br />
  211.                                 <%=ResourceManager.GetString("watermark")%><input id="watermark" onclick="changeWaterMark('watermark')" type="checkbox" />
  212.                                 X:<asp:TextBox runat=server id="inputx" style="width: 40px" maxlength="4" >0</asp:TextBox>&nbsp;<br />
  213.                                 <br />
  214.                                 <%=ResourceManager.GetString("watermarkText")%><input id="watermarkText" onclick="changeWaterMark('watermarkText')" type="checkbox" />
  215.                                 Y:<asp:TextBox runat=server id="inputy" style="width: 40px" maxlength="4" >0</asp:TextBox><br />
  216.                                 <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');}">
  217.                                 <%=ResourceManager.GetString("advancedsetting")%></a><a id='reload' href='uploadimg.aspx' style='display:none'></a></td>
  218.                         </tr>
  219.                     </table>
  220.                 </fieldset>
  221.                 <table width="100%" border="0px"><tr><td>
  222.                     [<%=ResourceManager.GetString("controlmenu")%>]:<asp:button id="selectAllBtn" runat="server"  borderstyle="Dashed" onclick="selectAllBtn_Click" ></asp:button>
  223.                         <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>
  224.                     <input language="javascript" onclick="if(is_ie){showModalDialog('find.aspx',this,'dialogWidth:320px;dialogHeight:130px;status:0;scroll:no');}else{window.find();}"
  225.                             type="button" value='<%=ResourceManager.GetString("findfile")%>' />
  226.                     <input language="javascript" onclick="window.close();" type="button" value="<%=ResourceManager.GetString("close")%>" /></td>
  227.     <td align="right">
  228.        <img border=0px src="img/logo_S.png" /></td>
  229. </tr></table>
  230.                         </fieldset>
  231.         <asp:HiddenField ID="config_watermark" runat="server" />
  232.         <asp:HiddenField ID="config_watermarkText" runat="server" />
  233.         <asp:HiddenField ID="config_watermarkImages" runat="server" />
  234.         <asp:HiddenField ID="config_watermakOption" runat="server" />
  235.         <asp:HiddenField ID="config_watermarkImages_path" runat="server" />
  236.         <asp:HiddenField ID="config_smallImages" runat="server" />
  237.         <asp:HiddenField ID="config_smallImagesName" runat="server" />
  238.         <asp:HiddenField ID="config_maxAllUploadSize" runat="server" />
  239.         <asp:HiddenField ID="config_autoname" runat="server" />
  240.         <asp:HiddenField ID="config_allowUpload" runat="server" />
  241.         <asp:HiddenField ID="config_fileFilters" runat="server" />
  242.         <asp:HiddenField ID="config_maxSingleUploadSize" runat="server" />
  243.         <asp:HiddenField ID="config_fileListBox" runat="server" />
  244.         <asp:HiddenField ID="config_watermarkImagesName" runat="server" />
  245.         <asp:HiddenField ID="config_watermarkName" runat="server" />
  246.         <asp:HiddenField ID="config_smallImagesType" runat="server" />
  247.         <asp:HiddenField ID="config_smallImagesW" runat="server" />
  248.         <asp:HiddenField ID="config_smallImagesH" runat="server" />
  249.         <asp:HiddenField ID="config_type" Value="Images" runat="server" />
  250.                     &nbsp;</td>
  251.             </tr>
  252.         </table>
  253.         <div id="loading" style="border-right: #333333 1px dashed; border-top: #333333 1px dashed;
  254.                         font-size: 9pt; visibility:hidden; border-left: #333333 1px dashed;
  255.                         width: 270px; color: #000000; border-bottom: #333333 1px dashed; position: absolute; height: 120px; background-color: #ffffff">
  256.                         <center>
  257.                             <br />
  258.                             <br />
  259.                             <%=ResourceManager.GetString("loading")%></center>
  260.                         <br />
  261.                         <center>
  262.                             <asp:Button ID="canceloading" runat="server" Style="border-top-style: dashed; border-right-style: dashed;
  263.                                 border-left-style: dashed; border-bottom-style: dashed" />&nbsp;</center>
  264.                         <br /></div>
  265. <script type="text/javascript" language="javascript">
  266. var load=document.getElementById('loading');
  267. window.onload=function(){resizeLoad()};
  268. function resizeLoad()
  269. {
  270. load.style.top = parseInt((document.body.clientHeight-load.offsetHeight)/2+document.body.scrollTop);
  271. load.style.left = parseInt((document.body.clientWidth-load.offsetWidth)/2+document.body.scrollLeft);
  272. }
  273. if(is_ie)
  274. {
  275. document.body.bgColor="ButtonFace";
  276. if (dialogArguments!=null)
  277. {
  278. image = dialogArguments;
  279. document.getElementById("ImgWidth").value=image[0];
  280. w=image[0];
  281. h=image[1];
  282. document.getElementById("ImgHeight").value=image[1];
  283. document.getElementById("ImgAlt").value=image[2];
  284. document.getElementById("file_path").value=image[3];
  285. document.getElementById("Imgalign").value=image[4];
  286. document.getElementById("insertImg").value='<%=ResourceManager.GetString("mof")%>';
  287. document.getElementById("previewImg").innerHTML='<img src='+image[3]+' align="middle" onload="w=this.width;h=this.height;if(this.width>300){this.width=300;this.height=Math.round(this.width*h/w);}if(this.height>225){this.height=225;this.width=Math.round(this.height*w/h);}" />';
  288. }
  289. }
  290. else
  291. {
  292. document.body.bgColor="#E0E0E0";
  293. if(image[0]!=null)
  294. {
  295. document.getElementById("ImgWidth").value=image[0];
  296. document.getElementById("ImgHeight").value=image[1];
  297. document.getElementById("ImgAlt").value=image[2];
  298. document.getElementById("file_path").value=image[3];
  299. document.getElementById("Imgalign").value=image[4];
  300. document.getElementById("insertImg").value='<%=ResourceManager.GetString("mof")%>';
  301. document.getElementById("previewImg").innerHTML='<img src='+image[3]+' align="middle" onload="w=this.width;h=this.height;if(this.width>300){this.width=300;this.height=Math.round(this.width*h/w);}if(this.height>225){this.height=225;this.width=Math.round(this.height*w/h);}" />';
  302. }
  303. }
  304. if(document.getElementById("config_watermarkImages").value.toLowerCase()=="true")
  305. {
  306. document.getElementById("watermark").checked=true;
  307. }
  308. if(document.getElementById("config_watermark").value.toLowerCase()=="true")
  309. {
  310. document.getElementById("watermarkText").checked=true;
  311. }
  312. if(document.getElementById("config_watermakOption").value.toLowerCase()=="off")
  313. {
  314. document.getElementById("watermarkText").disabled=true;
  315. document.getElementById("watermark").disabled=true;
  316. document.getElementById("inputx").disabled=true;
  317. document.getElementById("inputy").disabled=true;
  318. }
  319. </script>      
  320. </form>
  321. </body>
  322. </html>