代碼如下<%@ Page Language="vb" Debug="true" %>
<html>
<script language="vb" runat=server>
Sub uploadfile()sub uploadfile(sender as object, e as system.Eventargs)
dim s as string
s="d:\updata\" & system.io.path.getfilename(butimage.postedfile.filename)
butimage.postedfile.saveas(s)
end sub
</script>
<body>
<form runat="server" enctype="multipart/form-data">
<input type=file runat=server id=butimage/><br>
<input type=button id=yesbutton onserverclick=uploadfile runat=server value="提交"/>
</form>
</body>
</html>
運行後出現問題如下:
“/fileup”應用程式中的伺服器錯誤。
--------------------------------------------------------------------------------
未找到路徑“d:\updata\boat.gif”的一部分。
說明: 執行當前 Web 請求期間,出現未處理的異常。請檢查堆疊追蹤資訊,以瞭解有關該錯誤以及代碼中導致錯誤的出處的詳細資料。
異常詳細資料: System.IO.DirectoryNotFoundException: 未找到路徑“d:\updata\boat.gif”的一部分。
源錯誤:
行 7: dim s as string
行 8: s="d:\updata\" & system.io.path.getfilename(butimage.postedfile.filename)
行 9: butimage.postedfile.saveas(s)
行 10:
行 11: end sub
源檔案: c:\inetpub\wwwroot\fileup\index.aspx 行: 9
堆疊追蹤:
[DirectoryNotFoundException: 未找到路徑“d:\updata\boat.gif”的一部分。]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +287
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
System.IO.FileStream..ctor(String path, FileMode mode) +52
System.Web.HttpPostedFile.SaveAs(String filename) +48
ASP.index_aspx.uploadfile(Object sender, EventArgs e) in c:\inetpub\wwwroot\fileup\index.aspx:9
System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e) +108
System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138
System.Web.UI.Page.ProcessRequestMain() +1277
--------------------------------------------------------------------------------
版本資訊: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573
請各位大俠幫我看看呀!