2012-12-13 66 views
1

我在SharePoint上載圖片:爲什麼我的圖像不能在SharePoint中顯示?

我的圖像文件保存在文件夾中:IMAGES\\imagewebpart\\

Random rd = new Random(); 
    int db = rd.Next(0, 100); 
    string filename =Path.GetFileNameWithoutExtension(imagefile) + 
     db.ToString() + 
     Path.GetExtension(imagefile); 
    string filepath ="\\_layouts\\IMAGES\\imagewebpart\\" + filename; 
FileUpload1.SaveAs(Server.MapPath(filepath)); 
    //ImageEdit.ImageUrl =filepath; 
    ImageEdit.ImageUrl = Server.MapPath(filepath); 

我可以正常地保存它,但我不能顯示圖像ImageEdit

爲什麼?

回答

1

ImageEdit.ImageUrl = Server.MapPath(filepath);

嘗試此

ImageEdit.ImageUrl = filepath; 

其中,filepath = 「/ _layouts/IMAGES/imagewebpart /」 +文件名

相關問題