XlsUpLoad.asp
上传用户:prospercnc
上传日期:2019-12-08
资源大小:1314k
文件大小:3k
源码类别:

弱点检测代码

开发平台:

ASP/ASPX

  1. <!--#Include File="AdminCheck.asp"-->
  2. <!--#Include File="../Class/Cls_Upload.asp"--><%
  3. '==========================================
  4. '文 件 名:XlsUpLoad.asp
  5. '文件用途:文件上传
  6. '版权所有:方卡在线
  7. '==========================================
  8. '判断权限
  9. If Request.Cookies("AdminType002")>0 Then
  10. Response.Write("无权限")
  11. Response.End()
  12. End If
  13. %>
  14. <html>
  15. <head>
  16. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  17. <title>上传XLS文件</title>
  18. <style type="text/css">
  19. <!--
  20. body,td,th {
  21. font-size: 12px;
  22. }
  23. body {
  24. margin-left: 0px;
  25. margin-top: 8px;
  26. margin-right: 0px;
  27. margin-bottom: 0px;
  28. }
  29. a {
  30. font-size: 12px;
  31. color: #000;
  32. }
  33. a:link {
  34. text-decoration: none;
  35. }
  36. a:visited {
  37. text-decoration: none;
  38. color: #000;
  39. }
  40. a:hover {
  41. text-decoration: none;
  42. color: #333;
  43. }
  44. a:active {
  45. text-decoration: none;
  46. color: #000;
  47. }
  48. .Input,.Button {
  49. height:20px;
  50. line-height:20px;
  51. border:1px solid #999;
  52. border-bottom:1px solid #CCC;
  53. border-right:1px solid #CCC;
  54. }
  55. .Button {
  56. margin-left:0;
  57. }
  58. -->
  59. </style></head>
  60. <body>
  61. <%
  62. Call UpPic()
  63. '==============================
  64. '函 数 名:UpPic
  65. '作    用:上传图片
  66. '参    数:
  67. '==============================
  68. Sub UpPic()
  69. If Request.QueryString("Submit")="Pic" Then
  70. Dim UploadPath,UploadPath2,UploadSize,UploadType,UpRequest,AutoSave,Size,ShowSize,Str
  71. UploadPath="../Up/"
  72. UploadPath2="../Up/"
  73. UploadSize="10240"
  74. UploadType="xls"
  75. Set UpRequest=New UpLoadClass
  76. UpRequest.SavePath=UploadPath
  77. UpRequest.MaxSize=UploadSize*1024 
  78. UpRequest.FileType=UploadType
  79. AutoSave=true
  80. UpRequest.Open
  81. If UpRequest.Form("file_Err")<>0  Then
  82. Select Case UpRequest.Form("file_Err")
  83. Case 1:Str="<div style=""padding-top:5px;padding-bottom:5px;""> <font color=blue>上传不成功!文件超过"&UploadSize&"k [<a href='javascript:history.go(-1)'>重新上传</a>]</font></div>"
  84. Case 2:Str="<div style=""padding-top:5px;padding-bottom:5px;""> <font color=blue>上传不成功!文件格式不对 [<a href='javascript:history.go(-1)']>重新上传</a>]</font></div>"
  85. Case 3:Str="<div style=""padding-top:5px;padding-bottom:5px;""> <font color=blue>上传不成功!文件太大且格式不对 [<a href='javascript:history.go(-1)'>重新上传</a>]</font></div>"
  86. End Select
  87. Response.Write Str
  88. Else
  89. Response.Write "<script language=""javascript"">parent."&Request.QueryString("Form")&"."&Request.QueryString("Input")&".value='"&UploadPath2&UpRequest.Form("File")&"';" 
  90. Response.Write "</script>"
  91. Size=UpRequest.Form("file_size")
  92. ShowSize=Size & " Byte"   
  93. If Size>1024 Then  
  94. Size=(Size1024)  
  95. ShowSize=Size & " KB"  
  96. End If  
  97. If Size>1024 Then  
  98. Size=(Size/1024)  
  99. ShowSize=FormatNumber(Size,2) & " MB"   
  100. End If 
  101. Response.Write "<div style=""padding-top:5px;padding-bottom:5px;""> <font color=red>文件上传成功</font> [<a href='javascript:history.go(-1)'>重新上传</a>]</div>"
  102. End If
  103. Set UpRequest=nothing
  104. End If
  105. Response.Write "<Form name=Form action='?Submit=Pic&Form="&Request.QueryString("Form")&"&Input="&Request.QueryString("Input")&"' method=post enctype=multipart/Form-data>"
  106. Response.Write "<input type='file' name='file' class='Input' Size='20'>&nbsp;"
  107. Response.Write "<input type='submit' name='submit' value='上传' class=""Button"">"
  108. Response.Write "</Form>"
  109. End sub
  110. %>
  111. </body>
  112. </html>
  113. <!--#Include File="../Code.asp"-->