I'm using Chrome on Windows. FF works fine. This is on both SO and Meta. It worked just a few days ago. It's been reproduced by a few other people on Chrome in chat.

So, I can browse through my files, but no matter which file I select in which directory, the uploader shows it as if it's from the fakepath directory. The image name is correct though.

alt text

  • its still uploading stuff for me in latest chrome ... we can have wmd strip out fakepath .. but it feel low priority as everything is working
    – waffles
    Oct 24, 2010 at 22:37
  • Im running 7.0.517.41 ... which version are you on?
    – waffles
    Oct 24, 2010 at 23:13
  • @waffles - True the uploader is working. The funny thing is that it doesn't work w/ the one file above (so I originally thought the uploader itself was broken, but it was just my file), but it does work with my other files. Oct 24, 2010 at 23:15
  • @waffles - the same version btw. Oct 24, 2010 at 23:20
  • var fileUpload = $("#ContentPlaceHolder1_FileUpload_mediaFile").get(0); var files = fileUpload.files; var mediafilename = ""; for (var i = 0; i < files.length; i++) { mediafilename = files[i].name; } Jan 29, 2014 at 19:35

5 Answers 5


WHATWG says this is to be expected and related to HTML5.

The original plan was to just have the filename. Unfortunately, it turns out that if you do that, there are certain sites that break, because they expect the path (and they expect a Windows path, no less). This is why Opera and IE8 return a fake path -- not because HTML5 says to do it. In fact I made HTML5 say it because they were doing it.

(I would expect Firefox, Safari, and Chrome to follow suit; Firefox for compatibility, and Safari and Chrome for privacy.)

So if you don't see it, your browser is most likely a step behind the cycle.


Since we got rid of the fake filename input box, this is no longer an issue.


I believe this is a security feature of chrome. It does that at other sites too. You don't precisely want arbitrary people (not saying SE is arbitrary) seeing your directory structure, after all.

  • Yeah, directory names often reveal a lot about you. For starters, paths like C:\Documents and Settings\Sam\My Documents\My Pictures\crash.png and /home/naesten/hacking/haskell/hell.hs both reveal a username, which might be undesirable...
    – SamB
    Apr 30, 2011 at 21:46

Following up on waffle's response, a change like the following should work in all of the supported browsers:

$("#filename-input").change(function() {
    $("#shadow-filename").val(this.files && this.files.length ?
          this.files[0].name : this.value.replace(/^C:\\fakepath\\/i, ''));

...though I forget if IE7 exposes the real path to the file. If it does, the replace regex is insufficient, but displaying the real full path in that case seems harmless (from a "don't confuse the user" perspective) anyway.


I may parse out the filename in javascript so we don't show fakepath, as it can cause confusion.

Nonetheless, the uploader works fine.

  • 1
    Has this been implemented yet? :P
    – jcolebrand
    Jan 6, 2011 at 1:49
  • 1
    Why don't you let the browser manage the display of the file name? They do it quite well.
    – zneak
    Apr 22, 2011 at 18:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .