supfile.asp
上传用户:syzzy1975
上传日期:2022-07-17
资源大小:670k
文件大小:2k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
  2. <%OPTION EXPLICIT%>
  3. <!--#include FILE="inc/upload.inc"-->
  4. <html>
  5. <head>
  6. <title>上传图片</title>
  7. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  8. <link href="../style.css" rel="stylesheet" type="text/css">
  9. </head>
  10. <body bgcolor="#FFFFFF">
  11. <%
  12. dim upload,file,formName,formPath,iCount,sname,fsobj,fsobjd
  13. set upload=new upload_cwj
  14. if upload.form("filepath")="" then
  15. call MsgBox("请输入要上传至的目录!","Back","None")
  16. set upload=nothing
  17. response.end
  18. else
  19. '以年月为目录名存放图片
  20. formPath=upload.form("filepath")&year(now)&month(now)&"/"
  21. '如果目录不存在就建立
  22. set fsobjd=server.createobject("scripting.filesystemobject")
  23. if not fsobjd.folderexists(server.mappath(formPath)) then fsobjd.createfolder(server.mappath(formPath))
  24. set fsobjd=nothing
  25. if right(formPath,1)<>"/" then formPath=formPath&"/"&year(now)&month(now)&"/" 
  26. end if
  27. iCount=0
  28. for each formName in upload.file 
  29. set file=upload.file(formName) 
  30. if file.FileSize>0 then     
  31. file.SaveAs Server.mappath(formPath&file.FileName) 
  32. response.write "<br><center><font size=2 color=red>上传成功,请复制下边剪切板中内容而后粘贴到商品图片剪切板内!</font></center><br>"
  33. dim thename,spp,paths
  34. thename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&right(file.filename,4)
  35. spp=file.filename
  36. file.filename=thename
  37. file.SaveAs Server.mappath(formPath&file.FileName)
  38. paths=server.mappath("../")&"bookimages"&year(now)&month(now)&""&spp
  39. set fsobj=server.CreateObject("scripting.filesystemobject")
  40. if fsobj.fileExists(""&paths&"") then
  41. fsobj.deletefile(""&paths&"")
  42. end if
  43. set fsobj=nothing
  44. response.write "<center><input type=text size=40 value=bookimages/"&year(now)&month(now)&"/"&file.filename&"><button onclick=window.clipboardData.setData('text',this.previousSibling.value)>复制</button><br><br><a href='javascript:window.close()'><font color=red size=2>关闭窗口</font></a></center>"
  45. iCount=iCount+1
  46. end if
  47. set file=nothing
  48. next
  49. set upload=nothing 
  50. response.write "<font color=red size=2>"
  51. %>
  52. </body>
  53. </html>