'.vb Protected Sub btnFileUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) If myFileUpload.HasFile Then myFileUpload.SaveAs(Server.MapPath("uploads/" & myFileUpload.FileName)) End If End Sub
呼叫SaveAs把檔名存起來
'.vb Protected Sub btnFileUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) If myFileUpload.HasFile Then myFileUpload.SaveAs(Server.MapPath("uploads/" & myFileUpload.FileName)) End If End Sub
myFileUpload.PostedFile.FileName
取得檔名
myFileUpload.FileName
參考:
http://msdn.microsoft.com/zh-tw/library/system.web.ui.webcontrols.fileupload(VS.80).aspx
可否再列更詳盡的範例?
回覆刪除你是不是給兩段一模一樣的code..
回覆刪除