I'm uploading photos to a external library and the API to this library needs the path to the file I'm uploading.
Here is my Code:
public ActionResult UploadImageToCloudinary(HttpPostedFileBase file, string group, string filter)
{
if (file != null && file.ContentLength > 0)
{
// extract only the fielname
var fileName = Path.GetFileName(file.FileName);
if (fileName != null)
{
// get path including filename
var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
// other unimportant logic
}
return Content("Fail");
}
I've done this, but obviously it can't find it according to "~/App_Data/uploads"
It returns D:\Visual Studio Projects\Impola\Somefilder1\Somfolder2\App_Data\uploads\cara.jpg
and the real filepath is D:\MyProjects\Images\cara.jpg
which is the one I need.
How to get the real filepath?