图片上传失败,请指点
<head><title>文件上传系统</title>
<link href="../photo/css.css" rel="stylesheet" type="text/css">
<script language="javascript">
function CheckWorkFile() {
var obj = document.getElementById('TUPATH');
if (obj.value == '') {
alert('请先选择设备实物图片!');
return false;
}
var stuff = obj.value.substr(obj.value.length-3, 3);
if (stuff != 'JPG' && stuff != "BMP" && stuff != "GIF" && stuff != 'jpg' && stuff != "bmp" && stuff != "gif") {
alert('文件类型选择错误,仅支持JPG/BMP/GIF文件');
return false;
}
window.location.href = 'index.asp?lxs=tyzc&ph=' + obj.value;
}
</script>
</head>
<body>
文件上传:<input type="file" name="TUPATH" size="42"> <input type="button" value="提交" name="bb" onClick="CheckWorkFile();">
</body>
<%
dim LXS,file,filename,HZ
LXS = Request("lxs")
If LXS <> "" Then
file = Request("ph")
HZ = mid(file,InStrRev(file, "."))
filename=year(date) & month(date) & day(date) & Hour(time) & minute(time) & second(time) & HZ
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile file
objStream.SaveToFile
server.mappath("SBTP/"& HZ),2
objStream.Close
response.write"<script>alert('图片上传成功!');window.location.href='index.asp';</script>"
end if
%>