标题:
asp 简短的文件上传 小于1K 自己做的
[打印本页]
作者:
tearlight
时间:
2010-10-28 12:24
标题:
asp 简短的文件上传 小于1K 自己做的
经修改文件变大了,这是考虑到浏览器的兼容 经测试这个能在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>
欢迎光临 稻草软件论坛 (http://www.dcrjs.com/)
Powered by Discuz! 7.2