I m trying to upload an image and a thumbnail.
I have set the upload path in web.config as <add key="UploadPath" value="/Images"/>
when i upload the image, it get the full path of the hard drive and folder that application is in|:
D:\Projects\Social\FooApp\FooApp.BackOffice\Images\image_n.jpg
But i just want /images/image_n.jpg
I m using Path.Combine
do u think that the reason?
how can i resolve this?
this is the code|:\
foreach (var file in files)
{
if (file != null && file.ContentLength > 0)
{
var fileName = Path.GetFileName(file.FileName);
if (fileName != null) originalFile = Server.MapPath(upload_path) + DateTime.Now.Ticks + "_ " + fileName;
file.SaveAs(originalFile);
images.Add(originalFile);
}
}