📄 do_upload.asp
字号:
<%
Option Explicit
Response.Expires = -1
%>
<!-- #include file="conn.asp" -->
<html>
<head>
<title>Uploading file
</title>
</head>
<body>
<%
const UploadOK = 0
const FilesizeInvalid = 1
const ExtensionNotAllowed = 2
const DestinationPathInvalid = 3
const UnknownError = 4
const UnableToCreateFile = 5
const FileDoesntExist = 6
Dim nUploadResult
Dim objUploader
Dim strError
Dim dtype, file_name, user_name, version, file_info
Dim strFileUploaded
dim id, type_id, rs, i
dim path, size, ifinsert, fs, path_file
Set objUploader = Server.CreateObject("aspuploader.Uploader")
objUploader.StartUpload(Request)
file_name = objUploader.GetUploadFilename("file_name")
if Right(file_name, 4) <> ".zip" then
Response.write "文件名"&file_name&"必须以.zip为结尾<BR><a href=javascript:history.back(1)>返回</a>"
Response.End
end if
size =objUploader.GetFileSize("file_name")
user_name = objUploader.GetFormValue("user_name")
file_info = objUploader.GetFormValue("file_info")
dtype =objUploader.GetFormValue("dtype")
ifinsert =objUploader.GetFormValue("ifinsert")
set rs=conn.Execute("select * from d_type where dtype="&dtype)
path =""
if not rs.eof then
path=rs("path")
end if
path_file =path & "/" & file_name
'Set fs = CreateObject("scripting.FileSystemObject")
objUploader.SetDestinationPath path
objUploader.SetOverwrite ifinsert
objUploader.SetAllowedExtensions "*" ' all extensions
objUploader.SetForbiddenExtensions "exe", "com"
nUploadResult = objUploader.UploadFile("file_name")
if nUploadResult =0 then
'set rs =conn.Execute("select max(id)+1 from items")
'if not rs.eof then
'id =rs.fields(0).value
'end if
'if id ="" then
'id =1
'end if
'rs.close
response.write "上载成功<BR>文件:"&file_name&"<BR>路径:"&replace(rs("urls"), "download", "upload") &"》" & rs("type_name") & "<BR>文件大小:" & size & "<BR>"
else
strError = objUploader.GetError(nUploadResult)
response.write "上载失败,错误信息:"&strError&"<BR>"
end if
rs.close
conn.close
%>
<a href="/default.asp">返回首页</a>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -