Dim filepath As String = String.Empty
Dim filename As String = String.Empty
Dim filetype As String = String.Empty
If File1.PostedFile.FileName <> "" Then
filepath = File1.PostedFile.FileName
filetype = filepath.Substring(filepath.LastIndexOf(".") + 1)
filename = filepath.Substring(filepath.LastIndexOf("\") + 1)
If ("xls" <> filetype) Then
Me.lb_msg.Text = "只能選擇excel文件!!"
Exit Sub
Else
Try
Dim path As String = Server.MapPath("../xml")
File1.PostedFile.SaveAs(path + "\" + filename)
Me.lb_msg.Text = "上傳成功!!"
Catch ex As Exception
Me.lb_msg.Text = "上傳失敗!!" + ex.Message
End Try
End If
End If
posted on 2006-09-04 17:45
萌芽的叶子 阅读(332)
评论(0) 编辑 收藏 引用 所属分类:
asp.net 、
私人程序片断