2012-12-13 68 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 /” +文件名

相关问题