ASP+access图片上传 要求把上传的图片改名为最新的ID号
发布网友
发布时间:2024-10-03 15:31
我来回答
共1个回答
热心网友
时间:2024-10-11 23:42
<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 %><% end if %>