2012-09-12 28 views
0

我在我的辦公室使用IIS 7.5在Intranet上發佈了Web應用程序。我在表單中使用了「異步文件上傳」控件。 '用戶'上傳圖片後,顯示成功消息,路徑也存儲在數據庫&'圖像'被附加並通過電子郵件發送到'管理員'根據我的C#代碼。所有工作正常,但在我的系統中沒有看到任何圖像!我檢查了我的項目文件夾,並檢查了項目文件夾'C:\ inetpub \ wwwroot \ contractor \ Upload \ Commerical certificates'的路徑。任何人都可以幫助我在我的系統中獲取圖像。 (當我在我的獨立系統中使用應用程序時,圖像可用)。在哪裏可以看到「上傳圖片」

protected void AFUCmpCertificate_UploadedComplete(
       object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) 
    { 
    try 
    { 
    if (AFU1.HasFile) 
    { 
     String fileExt = System.IO.Path.GetExtension(AFU1.FileName); 
     if (fileExt == ".pdf" || fileExt == ".jpg" || fileExt == ".gif" 
     || fileExt == ".bmp" || fileExt == ".jpeg" || fileExt == ".png" || fileExt == ".tif") 
    { 
     if (AFU1.PostedFile.ContentLength < 2048000) 
     { 
     string filename = System.IO.Path.GetFileName(AFU1.FileName); 
     AFU1.SaveAs(Server.MapPath("~/Upload/Commerical Certificates/") 
         + lblBasicVendorID.Text + filename); 
     lblCommStatus.Text = "File uploaded"; 
     } 
     else 
     { 
     lblCommStatus.Text = "The file type not accepted or more than 2MB"; 
     } 
    } 
    } 
    } 
    catch (Exception ex) 
    { 
    lblCommStatus.Text = "The file could not be upload."; 
    } 
    } 
+0

是'C:\ inetpub \ wwwroot \ contractor \ Upload \ Commerical certificates'這個應用程序運行的Web服務器或本地機器上的路徑嗎? – simonlchilds

+0

只是調試,看看'Server.MapPath(「〜/ Upload/Commerical Certificates /」)的價值是什麼' –

+0

@simonlchilds:我的本地機器的路徑。我在其中創建了文件夾'Upload'和'Commerical Certificates'。 – Hari

回答

0

我是IIS的新手,所以我不爲我的網站創建「網站」下的「虛擬目錄」。我右鍵點擊我的網站名稱,並給予「別名」名稱,物理路徑爲「D:\ Upload」,以便最終用戶在網站上存儲上傳圖像。現在我知道上傳圖像的位置。

0

我使用的是IIS 7.5

我假定這意味着發佈在我的辦公室在Intranet Web應用程序,你有你的應用程序在你的辦公室在Web服務器上運行的地方,即不你的本地機器。因此,爲了找到上傳到應用程序的文件,在Web服務器上運行,您需要查看Web服務器而不是本地機器 - 是的?

+0

好的Mr.simonlcilds.Before我在互聯網上部署我的應用程序之前我想測試應用程序,所以我發佈應用程序在Intranet上使用IIS從我的機器(不是從生產服務器)。我現在必須看到上傳的圖像根據你的想法在網絡服務器? – Hari

+0

你對「內聯網」的想法是什麼?因爲對我來說,內聯網是一個網絡服務器的內部網絡。至於你的問題,我不知道。也許由於權限問題,圖像未被保存? – simonlchilds

+0

沒有權限問題。 Intranet意味着我可以使用LAN連接在辦公室內部的應用程序。我的鏈接地址是這樣的http://hari-pc/contractor/UserLogin.aspx – Hari

相關問題