It might be helpful,
if (!Directory.Exists(Path.Combine(UploadPath, docLocation)))
{
Directory.CreateDirectory(Path.Combine(UploadPath, docLocation));
}
var result = Path.Combine(UploadPath, docLocation, OtherFileName);
Behind the scene
Combine
method will check for the invalid characters using Framework's
CheckInvalidPathChars(string item)
.
:)