MozillaZine

Unable to get file full path in Firefox using file browse di

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
stephenrodrics
 
Posts: 1
Joined: November 28th, 2014, 6:01 am

Post Posted November 28th, 2014, 6:08 am

Hi All,

I have a file browse dialog page,I use it to browse the file name to do import operation on submit of form, I am able to get the filename, but fails to get full file path in Firefox, this code works fine in IE and returns full file path, but in Firefox it only returns the file name, I want full file path to do import operation.

can anyone tell what is the solution in Firefox

Code: Select all
script type="text/javascript">
function performClick(elemId)
{

   var elem = document.getElementById(elemId);
    alert(elem.value);
 }
}
</script>

<a href="#" onclick="performClick('theFile');">Open file dialog</a>
<input  type="file" id="theFile" name  = "theFile" />


thanks in advance

Dom1953
 
Posts: 52
Joined: July 24th, 2014, 6:02 am
Location: Australia

Post Posted November 28th, 2014, 2:05 pm

From memory this is a security loophole that was closed during the days of Netscape 4: neither web page script nor the server get access to information about the client's file system. So you should be able to browse for a file using a form control and upload it on form submission but web pages are not intended (in Firefox) to be able to determine where the file was stored locally. In other words scripts not being able to access the path does not mean Firefox doesn't know how to upload the file.

Does this match your experience?

Return to Web Development / Standards Evangelism


Who is online

Users browsing this forum: No registered users and 1 guest