For my project I'm setting up a page where you can change your profile and upload an image. I've got all of that to work but now I want to make my image unique by matching the file name with the Username (which already is unique) but I couldn't find a good guide anywhere on google. Here is my code:
{
if (PfFoto != null)
{
string pic = System.IO.Path.GetFileName(PfFoto.FileName);
string path = System.IO.Path.Combine(Server.MapPath("/images/PFfotos"), pic);
PfFoto.SaveAs(path);
return RedirectToAction("Index");
}
}
My username is stored in changePF.Name
and the file name is stored in pic
so does anyone know how to do this?