有關檔案上傳儲存的問題

來源:互聯網
上載者:User
代碼如下<%@ 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 

請各位大俠幫我看看呀!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.