I have a file upload control in my visual web part which will enable user to select the image. I want to put it in the mapped folder.
My code is:
if (flPicture.HasFile)
{
SPSite site = SPContext.Current.Site;
flPicture.SaveAs(site.Url+"/_layouts/Images/CommunityFormWebPart/" + flPicture.FileName);
imgPicture.ImageUrl="_layouts/Images/CommunityFormWebPart" + flPicture.FileName;
imgPicture.Visible = true;
}
But I am getting the error at line flPicture.SaveAs
that the url is not rooted.
What should I do?