0

I am having a file upload control in my page. I want to get the full path of the uploaded file by javascript. i have written

document.getElmentById('fileControl").value;

It is showing the full path in IE but in mozilla 3.5 it is showing only the filename not the path.

So how to solve this problem ?

1
  • Can you be more specific on your requirement? Commented Aug 28, 2009 at 4:45

2 Answers 2

4

This will be a security issue. Reading the file path of the client machine is not a good idea and won't be allowed by most of the browsers.

Sign up to request clarification or add additional context in comments.

Comments

0

Firefox doesn't let you see the path to the file by default - apparently there is a workaround for it but it requires the user to go to about:config and change a setting, which let's face it, ain't going to happen most of the time.

If you absolutely need this (I can't see why though) then you could look at using Flash as a cross-browser alternative, google for Flash and file uploads.

Otherwise, you'll need to work with the limitation here (which in my mind is a very good one!)

6 Comments

which setting we have to change for that in Firefox ?
You can't alter settings to a client browser from your web application.
No i don't want to do that but i only want to know :)
I'm pretty sure you can't get the file path from Flash either - the file upload security sandbox prevents anything more than getting a handle to the bytestream which the user selected through a closed dialog.
but i have write a demo which i can show it to someone so i can adjust with any approach coz this thing will not get published anyway.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.