Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Mozilla サポートの検索

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

詳しく学ぶ

このスレッドはアーカイブに保管されました。 必要であれば新たに質問してください。

Firefox loses path of File Input control

  • 2 件の返信
  • 55 人がこの問題に困っています
  • 7 回表示
  • 最後の返信者: zzxc

more options

I have a File Input control in my form. Using JavaScript, I try to retrieve the full pathes file name of the user's selection. In fileInput.value, I can see (for example) C:\SomeFile.txt. But, the very next line I try to extract that value, like this:

var FullPathFileName = fileInput.value;

In FullPathFileName, I get only SomeFile.txt.

Using FireBug, I hover over that line of code. Hovering over fileInput.value, it shows the full path. Hovering over FullPathFileName, it shows only the file name.

Why does this happen, and how can I stop it? I really need the fully pathed file name.

User Agent

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8)

I have a File Input control in my form. Using JavaScript, I try to retrieve the full pathes file name of the user's selection. In fileInput.value, I can see (for example) C:\SomeFile.txt. But, the very next line I try to extract that value, like this: var FullPathFileName = fileInput.value; In FullPathFileName, I get only SomeFile.txt. Using FireBug, I hover over that line of code. Hovering over fileInput.value, it shows the full path. Hovering over FullPathFileName, it shows only the file name. Why does this happen, and how can I stop it? I really need the fully pathed file name. == User Agent == Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8)

すべての返信 (2)

more options

This is a security restriction, so as not to expose the full path on the filesystem to javascript. It prevents javascript on websites from gaining potentially sensitive information from filesystem paths.

more options

See: Bug 143220 - [FIX]Script can get the value of a file control, including the path (#c49 #c50)

[tiki-view_forum_thread.php?comments_parentId=200996&forumId=1 File Input don't return full path in Javascript] (input type=file)