签到天数: 36 天 [LV.5]常住居民I - UID
- 335
- 帖子
- 104
- 精华
- 1
- 积分
- 1122
- 软件
- 143 套
- 稻币
- 170 元
- 贡献
- 163
- 违规
- 0 次
- 注册时间
- 2009-10-20
|
经修改文件变大了,这是考虑到浏览器的兼容 经测试这个能在IE 火狐 GOOGLE浏览器运行
<html>
<head>
<title>文件上传</title>
</head>
<body>
<form method="POST" action="upload.asp">
<input type="file" name="file" size="42"> <input type="submit" value="提交" name="tj">
</form>
<%
if request.Form("tj")="提交" then
dim file ,filename
file = Request.Form("file")
if file="" then
response.write"<script>alert('请选择文件!');location.href='upload.asp';</script>"
else
houzui=mid(file,InStrRev(file, "."))
filename=year(date) & month(date) & day(date) & Hour(time) & minute(time) & second(time) & houzui
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.SaveToFile Server.MapPath(file),2
objStream.Close
response.write"<script>alert('上传成功!');location.href='upload.asp';</script>"
end if
end if
%>
</body>
</html> |
|