Need full pathname from type=file, or alternative mechanism

I need to be able to put a pathname to an image file in a database. I've tried using:

<input type="file" ... />

to let the user browse to the file, but that only returns the filename, not the full path. Further research shows that this is a "security" feature and browsers do not return the full path.

Is there any way to do this with html/javascript? It will be impossible to get the full path to the image file without this ability.

btw - I know I can do this with IE by enabling the 'Security' setting "Include local directory path when uploading files to a server", so don't bother sending that as a solution. I'm looking for something non-browser dependent, if such a mechanism exists.
LVL 1
jmarkfoleyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

plusone3055Commented:
http://jsfiddle.net/dwebexperts/4FGg8/1/


HTML
<input type="file" id="i_file" value=""> 
<input type="button" id="i_submit" value="Submit">
    <br>
<img src="" width="200" style="display:none;" />
        <br>
<div id="disp_tmp_path"></div>

Open in new window



Javascript
$('#i_file').change( function(event) {
var tmppath = URL.createObjectURL(event.target.files[0]);
    $("img").fadeIn("fast").attr('src',URL.createObjectURL(event.target.files[0]));
    
    $("#disp_tmp_path").html("Temporary Path(Copy it and try pasting it in browser address bar) --> <strong>["+tmppath+"]</strong>");
});

Open in new window

0
Dave BaldwinFixer of ProblemsCommented:
Note that to 'browse to a file' on their own computer, you would have to use the 'file://' protocol and you will that that is also blocked in modern browsers.
0
jmarkfoleyAuthor Commented:
plusone3055: I couldn't get that example working. Maybe I'll try another time.

My current solution in IE is to enable: Tools > Internet Options > Security > Custom > 'Include Directory Path when uploading files to a server'. That does the trick for IE which is all I need at the moment.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jmarkfoleyAuthor Commented:
I figured out a workaround
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.