1

I have created an intranet application and am having some difficulties with IE and safari on windows when trying to use the following code to save a posted file to an internal folder within the MVC solution folder structure:

postedFile.SaveAs(HttpContext.Current.Server.MapPath("~/" + baseFolderName + "/" + contentFolder + "/" + fileName));

This works as expected when using Firefox and chrome so I am unsure as to why this is happening something to do with the format of the string.

System.NotSupportedException: The given path's format is not supported.

The name of the basefolder and contentfolder being passed are the same in the tests so I am assuming the problem lies with IE trying to find the path.

tshepang
  • 12,111
  • 21
  • 91
  • 136
Jay
  • 3,012
  • 14
  • 48
  • 99
  • You shoukd give extar info. Where do baseFolderName, and the other vars come from? Has you debugged and seen their values when you're using IE? – JotaBe Dec 17 '13 at 14:31
  • error was in the image.FileName path with IE as it was picking up full path which Chrome and Firefox seem to omit quite handily – Jay Dec 17 '13 at 14:39

1 Answers1

3

IE was getting the FileName of the posted file with its location included. I resolved the issue by getting just the file extension with the following code:

System.IO.Path.GetFileName(image.FileName))
Jay
  • 3,012
  • 14
  • 48
  • 99