<script language="vb" runat="server">
sub Button_Click(Source As Object, e As EventArgs)
dim shti as short
dim files as httpfilecollection
files=request.files
for shti=0 to files.count-1
if files.item(shti).contentlength>0 then
dim tmp()=split(files.item(shti).filename,"\")
dim fname=tmp(tmp.length-1)
files.item(shti).saveas(server.mappath(".") & "\" & fname)
end if
next
end sub
</script>
根据原理我们可以扩展以下代码:
upload.asp文件
<%
Function GetFileName(ByVal strFile)
If strFile <> "" Then
GetFileName = mid(strFile,InStrRev(strFile, "\")+1)
Else
GetFileName = ""
End If
End function