/    Sign up×
Community /Pin to ProfileBookmark

Trying to get full path value of file in a form… works in IE, not Firefox

I’m trying to grab a file path from a form and pass it to hidden variable. To be honest I don’t quite remember why I did it this way, but it doesn’t matter since both the file element of the form and the hidden element after the passing get the full path in IE, and both get only the file name in Firefox.

Anyone know how I would get the full path in Firefox? We’re trying to get our users off of IE and onto Firefox so it wouldn’t make much sense to require IE on this report generator only.

This is the HTML section of the form…

[CODE]Export save location: <input name=”locationtemp” type=”file” size=’30’ id=’testid’ />
<br><br>
<input name=”locationfinal” type=”hidden” id=’testid2′ />[/CODE]

And this is the JavaScript which gets the path and passes it back to a the hidden variable. The “pname” part doesn’t have much to do with the problem, it is just a way to keep track of what page this stuff is being passed from.

[CODE]
function getlink(pname)
{
var pname = pname;

var newlink=document.getElementById(‘testid’);
newlink=newlink.value;

var newlink2=document.getElementById(‘testid2’);
newlink2.value=newlink;

var passpname=document.getElementById(‘pname’);
passpname.value=pname;
}
[/CODE]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@xvszeroauthorSep 24.2008 — This is Firefox 3 by the way. It worked in 2.
Copy linkTweet thisAlerts:
@DokSep 24.2008 — This is a new security restriction in Firefox 3 for privacy reasons. According to bugzilla this behavior will also be implemented in IE8.

Even though some work arounds (can't tell if they actually work or not) are suggested I would not myself depend on them as mozilla will likely close such loopholes. Mozilla also has an official note about the change.
Copy linkTweet thisAlerts:
@avitardotnetSep 24.2008 — This is a new security restriction in Firefox 3 for privacy reasons. According to bugzilla this behavior will also be implemented in IE8.

Even though some work arounds (can't tell if they actually work or not) are suggested I would not myself depend on them as mozilla will likely close such loopholes. Mozilla also has an official note about the change.[/QUOTE]


To expand on this a little, it is seen by most browser makers as a security hole since it can possibly give local client machine data that exposes file structure to malicious web sites.
×

Success!

Help @xvszero spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...