<input type=‘file’> for IE gives full path, need file name only

Try this at the server side:

Path.GetFileName(file.FileName)

The point of the file input is to provide a file. Names that come with it are "whatever the browser vendor feels like using", they aren't guaranteed to have anything to do with the file name on the file system at all.

You can't change what the browser sends.

If you are going to make use of the name sent by the browser, then you need to make sure it is valid for whatever you are going to do with it (e.g. make sure it only includes characters that are allowed in filenames on your filesystem). This makes it something that must be handled on the server (just like any other client supplied data).


There is also an IE option under:

  • Internet Options
  • Security tab
  • In "Internet" or "Intranet" click on Custom Level
  • In the Security Settings scroll down until you see “Include local directory path when uploading files to a server” and disable it.
  • Click OK on Internet Options window and refresh.