upload_base.aspx 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="upload_base.aspx.cs" Inherits="iNethinkCMS.Web.inc.upload_base" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head runat="server">
  5. <title></title>
  6. <script src="../admin/skin/js/jquery.min.js" type="text/javascript"></script>
  7. <script type="text/javascript">
  8. function LoadFile(filePath, fileType) {
  9. var byInfo = false;
  10. var strPath = filePath.toLowerCase();
  11. var strExt = strPath.substr(strPath.length - 4, 4).replace(/./, ",") + ",";
  12. var strType = "," + fileType.toLowerCase() + ",";
  13. if (strType.indexOf(strExt) == -1) {
  14. byInfo = false;
  15. } else {
  16. byInfo = true;
  17. }
  18. return byInfo;
  19. }
  20. function do_fileselect(val) {
  21. var vFilePath = $('#FileUpload').val()
  22. if (vFilePath != "") {
  23. parent.$('#iUpInfo_msg_' + val).html("已选择文件:" + $('#FileUpload').val());
  24. parent.$('#iUpInfo_' + val).css({ display: "block" });
  25. $('#Button_up').attr("disabled", false);
  26. } else {
  27. parent.$('#iUpInfo_msg_' + val).html("");
  28. parent.$('#iUpInfo_' + val).css({ display: "none" });
  29. $('#Button_up').attr("disabled", true);
  30. }
  31. }
  32. function do_isup(val) {
  33. if ($('#FileUpload').val() == "") {
  34. alert("请选择需要上传的文件!");
  35. return false;
  36. }
  37. var vFileExt = "<%=siteConfig.UpFileType%>";
  38. if (LoadFile($('#FileUpload').val(), vFileExt) == false) {
  39. alert("仅允许上传:" + vFileExt);
  40. return false;
  41. }
  42. parent.$('#iUpInfo_msg_' + val).html("<img src='/admin/skin/images/loading.gif'>&nbsp;正在上传文件,请稍等...");
  43. parent.$('#iUpInfo_' + val).css({ display: "block" });
  44. }
  45. </script>
  46. <style type="text/css">
  47. * {
  48. margin: 0;
  49. padding: 0;
  50. }
  51. .upbutton {
  52. background: url("../admin/skin/images/pic.gif") no-repeat;
  53. width: 80px;
  54. text-align: center;
  55. color: rgb(255, 255, 255);
  56. height: 25px;
  57. margin-right: 10px;
  58. border: none;
  59. }
  60. .fileshows {
  61. position: absolute;
  62. left: 202px;
  63. top: 52px;
  64. height: 26px;
  65. cursor: pointer;
  66. filter: Alpha(opacity=0);
  67. -moz-opacity: 0;
  68. opacity: 0;
  69. }
  70. </style>
  71. </head>
  72. <body>
  73. <form id="form_upload_base" runat="server">
  74. <div>
  75. <input type="button" onmousemove="FileUpload.style.pixelLeft=event.clientX-75;FileUpload.style.pixelTop=this.offsetTop;"
  76. value="文件浏览" onclick="FileUpload.click();" class="upbutton" />
  77. <asp:FileUpload ID="FileUpload" runat="server" Width="80" class="fileshows" hidefocus
  78. BorderStyle="None" />
  79. <asp:Button ID="Button_up" runat="server" Text="文件上传" CssClass="upbutton" OnClick="Button_up_Click" />
  80. </div>
  81. </form>
  82. </body>
  83. </html>