asp 图片上传代码
<head><metahttp-equiv="Content-Language"content="zh-cn"></head><center><%Response.Exp...
<head>
<meta http-equiv="Content-Language" content="zh-cn">
</head>
<center><%Response.Expires=0:if Request.TotalBytes then:set a=createobject("adodb.stream"):a.Type=1:a.Open:a.write Request.BinaryRead(Request.TotalBytes):a.Position=0:b=a.Read:c=chrB(13)&chrB(10):d=clng(instrb(b,c)):e=instrb(d+1,b,c):set f=createobject("adodb.stream"):f.type=1:f.open:a.Position=d+1:a.copyto f,e-d-3:f.Position=0:f.type=2:f.CharSet="GB2312":g=f.readtext:f.Close:h=mid(g,instrRev(g,"\")+1,e):i=instrb(b,c&c)+4:j=instrb(i+1,b,leftB(b,d-1))-i-2:f.Type=1:f.Open:a.Position=i-1:a.CopyTo f,j:f.SaveToFile server.mappath(h),2:f.Close:set f=Nothing:a.Close:set a=Nothing:response.write "<a href="&Server.URlEncode(h)&" target=_blank>"& h &"</a>"%>
<form enctype=multipart/form-data method=post name="uploada">
<input type=file name=fe size="26">
<input type="button" value="上传" name="B1" onclick="checkupload()"></form>
<script language=javascript>
function checkupload()
{
if (uploada.fe.value.indexOf(".jpg")>0 || uploada.fe.value.indexOf(".gif")>0 || uploada.fe.value.indexOf(".png")>0 || uploada.fe.value.indexOf(".bmp")>0)
{
document.uploada.B1.disabled=true;
document.uploada.B1.value="上传中.";
uploada.submit()
alert("上传成功");
}
else
{
alert("您上传的不是图片!\n可以上传的图片格式为\"*.jpg\",\"*.gif\",\"*.png\",\"*.bmp\"");
}
}
</script>
<% if h<>"" then %>
<script language="javascript">
var msg=confirm("图片已上传成功,是否预览图片?\n点击[确定]后预览,然后关闭\n点击[取消]不预览.然后关闭")
if (msg)
{
window.open("<%=h%>")
window.opener.document.frm3.pro_pic.value="<%="upload/"&h%>";
window.close();
}
else
{
window.opener.document.frm3.pro_pic.value="<%="upload/"&h%>";
window.close();
}
</script>
<% end if %>
源码加入此代码后数据库改添加什么字段 展开
<meta http-equiv="Content-Language" content="zh-cn">
</head>
<center><%Response.Expires=0:if Request.TotalBytes then:set a=createobject("adodb.stream"):a.Type=1:a.Open:a.write Request.BinaryRead(Request.TotalBytes):a.Position=0:b=a.Read:c=chrB(13)&chrB(10):d=clng(instrb(b,c)):e=instrb(d+1,b,c):set f=createobject("adodb.stream"):f.type=1:f.open:a.Position=d+1:a.copyto f,e-d-3:f.Position=0:f.type=2:f.CharSet="GB2312":g=f.readtext:f.Close:h=mid(g,instrRev(g,"\")+1,e):i=instrb(b,c&c)+4:j=instrb(i+1,b,leftB(b,d-1))-i-2:f.Type=1:f.Open:a.Position=i-1:a.CopyTo f,j:f.SaveToFile server.mappath(h),2:f.Close:set f=Nothing:a.Close:set a=Nothing:response.write "<a href="&Server.URlEncode(h)&" target=_blank>"& h &"</a>"%>
<form enctype=multipart/form-data method=post name="uploada">
<input type=file name=fe size="26">
<input type="button" value="上传" name="B1" onclick="checkupload()"></form>
<script language=javascript>
function checkupload()
{
if (uploada.fe.value.indexOf(".jpg")>0 || uploada.fe.value.indexOf(".gif")>0 || uploada.fe.value.indexOf(".png")>0 || uploada.fe.value.indexOf(".bmp")>0)
{
document.uploada.B1.disabled=true;
document.uploada.B1.value="上传中.";
uploada.submit()
alert("上传成功");
}
else
{
alert("您上传的不是图片!\n可以上传的图片格式为\"*.jpg\",\"*.gif\",\"*.png\",\"*.bmp\"");
}
}
</script>
<% if h<>"" then %>
<script language="javascript">
var msg=confirm("图片已上传成功,是否预览图片?\n点击[确定]后预览,然后关闭\n点击[取消]不预览.然后关闭")
if (msg)
{
window.open("<%=h%>")
window.opener.document.frm3.pro_pic.value="<%="upload/"&h%>";
window.close();
}
else
{
window.opener.document.frm3.pro_pic.value="<%="upload/"&h%>";
window.close();
}
</script>
<% end if %>
源码加入此代码后数据库改添加什么字段 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询