化境无组件上传文件如何使用原文件名
怎么可以把上传用原文件名,现是时间命名的,<%subupload_0()'使用化境无组件上传类setupload=newupfile_class''upload.GetD...
怎么可以把上传用原文件名,现是时间命名的,
<%
sub upload_0() '使用化境无组件上传类
set upload=new upfile_class ''
upload.GetData(104857600) '
if upload.err > 0 then '
select case upload.err
case 1
response.write
case 2
response.write
end select
response.end
end if
PhotoUrlID=Clng(trim(upload.form("PhotoUrlID")))
if PhotoUrlID>0 then
SavePath = SaveUpFilesPath
else
SavePath = SaveUpFilesPath
end if
if right(SavePath,1)<>"/" then SavePath=SavePath&"/"
for each formName in upload.file
set ofile=upload.file(formName)
oFileSize=ofile.filesize
if oFileSize<100 then
msg="请先选择你要上传的文件!"
FoundErr=True
else
select case PhotoUrlID
case 0
if oFileSize>(MaxFileSize*1024) then
msg="文件大小超过了限制,最大只能上传" & CStr(MaxFileSize) & "K的文件!"
FoundErr=true
end if
case 1
if oFileSize>(10000*1024) then
msg="文件大小超过了限制,最大只能上传10M的文件!"
FoundErr=true
end if
end select
end if
strJS="<SCRIPT language=javascript>" & vbcrlf
if FoundErr<>true then
randomize
ranNum=int(900*rnd)+100
filename=SavePath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
ofile.SaveToFile Server.mappath(FileName) '保存文件
response.write "文件上传成功!文件大小为:" & cstr(round(oFileSize/1024)) & "K"
select case PhotoUrlID 展开
<%
sub upload_0() '使用化境无组件上传类
set upload=new upfile_class ''
upload.GetData(104857600) '
if upload.err > 0 then '
select case upload.err
case 1
response.write
case 2
response.write
end select
response.end
end if
PhotoUrlID=Clng(trim(upload.form("PhotoUrlID")))
if PhotoUrlID>0 then
SavePath = SaveUpFilesPath
else
SavePath = SaveUpFilesPath
end if
if right(SavePath,1)<>"/" then SavePath=SavePath&"/"
for each formName in upload.file
set ofile=upload.file(formName)
oFileSize=ofile.filesize
if oFileSize<100 then
msg="请先选择你要上传的文件!"
FoundErr=True
else
select case PhotoUrlID
case 0
if oFileSize>(MaxFileSize*1024) then
msg="文件大小超过了限制,最大只能上传" & CStr(MaxFileSize) & "K的文件!"
FoundErr=true
end if
case 1
if oFileSize>(10000*1024) then
msg="文件大小超过了限制,最大只能上传10M的文件!"
FoundErr=true
end if
end select
end if
strJS="<SCRIPT language=javascript>" & vbcrlf
if FoundErr<>true then
randomize
ranNum=int(900*rnd)+100
filename=SavePath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
ofile.SaveToFile Server.mappath(FileName) '保存文件
response.write "文件上传成功!文件大小为:" & cstr(round(oFileSize/1024)) & "K"
select case PhotoUrlID 展开
2个回答
展开全部
for each formName in upload.objFile ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath(formPath&file.FileName) ''保存文件
end if
set file=nothing
next
set file=upload.file(formName) ''生成一个文件对象
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath(formPath&file.FileName) ''保存文件
end if
set file=nothing
next
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询