Supposedly, HTTPPostedFile.FileName is supposed to contain just the name of the uploaded file. It should exclude the original filename path. This doesn’t always appear to be the case, and seems to vary by the browser doing an upload.
To avoid the browser issue entirely, use a FileInfo(HttpPostedFile.FileName) to return just the file name (and extension) portion of the file.
Change this:
Code Snippet
- var saveFileName = Path.Combine(UploadedFileServerPath, FilePackage.PostedFile.FileName);
to this:
Code Snippet
- var saveFileName = Path.Combine(UploadedFileServerPath, new FileInfo(FilePackage.PostedFile.FileName).Name);