1、index.htm直接双击浏览器打开正常,但在IIS下测试显示就不正常(无选择图片汉字,但点击相应区域能弹出图片选择框,但选择后表不新增一行显示选择文件的相关信息),转成ASP同样(要求最终为ASP文件)。
2、点击提交后,将所选择的图片全部上传至Upload目录,每上传成功一张图片就将服务器中新的图片名称(绝对路径)和表格中对应此图片的说明内容写入到数据库的PicList表中(也就是多次选择,一次上传)。
文件提取地址
链接:https://pan.baidu.com/s/1xCz8uAMs35WBcTB5WW1e8w
提取码:atkr
改了3小时 前面终于跑通了。。又遇到一个大坑。。
代码使用了一个第三方组件 Server.CreateObject("Persits.Jpeg")
我的电脑没有这个组件 我又从网上百度了一个 安装了 asp 识别不出来。。。
楼主如果有这个组件 方便的话打包给我再试试。。
我写过一个类似的,你参考下
<%
if session("admin")<>"on" then
Response.Redirect"login.asp"
end if
%>
<!--#include file="config.asp" -->
<!--#include file="mdb/conn.asp" -->
<%
Set Upload = Server.CreateObject("Persits.Upload")
FilePath=Server.MapPath(".")
Count = Upload.Save(FilePath&BigPhotoPath) '传大图
SmallFilePath=FilePath & SmallPhotoPath
For Each File in Upload.Files
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open (File.Path)
BigFP=BigPhotoPath&(File.FileName) '大图相对路径
SFP=SmallPhotoPath&"S_"&(File.FileName)'小图相对路径
FileSize=File.Size'备写入数据库
'开始判断哪边为长边,以长边进行缩放,并生成小图
imgWidth=Jpeg.OriginalWidth
imgHeight=Jpeg.OriginalHeight
if imgWidth>=imgHeight and imgWidth>120 then
Jpeg.Width=150
Jpeg.Height=Jpeg.OriginalHeight/(Jpeg.OriginalWidth/150)
end if
if imgHeight>imgWidth and imgHeight>113 then
Jpeg.Height=113
Jpeg.Width=Jpeg.OriginalWidth/(Jpeg.OriginalHeight/113)
end if
Jpeg.Sharpen 1, 130
Jpeg.Save (SmallFilePath&"S_"&File.FileName)
'给大图加上水印(仅对大图加水印)
Jpeg.Open Server.MapPath(""&BigFP&"")
Jpeg.Canvas.Font.Color = &HFF0000
Jpeg.Canvas.Font.Family = "Courier New"
Jpeg.Canvas.Pen.Color = &H000000
Jpeg.Canvas.Pen.Width = 2
Jpeg.Canvas.Brush.Solid = False
Jpeg.Canvas.Font.BkMode = "Opaque" '处理平滑
Jpeg.Canvas.PrintText 10, 10, "www.LuanLuan.cn"
'Jpeg.Canvas.DrawBar 1, 1, 100, 100
Jpeg.Save Server.MapPath(BigFP)
Next
strSQL= "insert into desktop ([name],typeid,zhuanti,jj,[time],imgh,imgw,filesize,url,surl) values ('"&Upload.Form("name")&"','"&Upload.Form("typeid")&"','"&Upload.Form("zhuanti")&"','"&Upload.Form("photointro")&"','"&Now()&"','"&imgheight&"','"&imgwidth&"','"&FileSize &"','"&BigFP&"','"&SFP&"')"
conn.execute strSQL
set upload=nothing '删除对象
typeid=Request.QueryString("typeid")
response.write "<SCRIPT language=JavaScript>alert('文件上传成功,返回!');"
response.write "this.location.href='addfile.asp?typeid="&typeid&"';</SCRIPT>"
function HTMLEncode2(fString)
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
fString = Replace(fString, CHR(10), "<BR>")
HTMLEncode2 = fString
end function
%>
自己已经解决,虽然都没采用,还是谢谢!