Solved

How to catch the full path plus filename with input type="file" in FF

Posted on 2007-04-06
6
12,474 Views
Last Modified: 2013-11-19
Hi Experts,

I have a <input type="file"...> in my HTML form
and I want to see the full path plus filename of a selected file as a parameter,
for the form processing.

I use my browser as a GUI interface to an application that requires some file manipulation.
So I don't necessary need to upload the selected file, I just need the full local reference.

IE gives that to me, FF only gives me the filename, not the path

Does anyone have a workaround?

Thanks

Geert
0
Comment
Question by:Geert Bormans
6 Comments
 
LVL 7

Expert Comment

by:RealSnaD
ID: 18867311
<input id="filepath" type="file">

<input type="button" onclick="alert(document.getElementById('filepath').value)" value="Go"1>
0
 
LVL 7

Accepted Solution

by:
RealSnaD earned 500 total points
ID: 18867313
<input id="filepath" type="file">

<input type="button" onclick="alert(document.getElementById('filepath').value)" value="Go">
0
 
LVL 60

Author Comment

by:Geert Bormans
ID: 18881722
Thanks,

I implemented your solution like this
<input type="file" value="browsedFileName" name="browsedFileName" id="browsedFileName" onChange="document.getElementById('fileName').value = this.value"/>
<!-- I need this mimic input text field to overcome the fact that FireFox doesn't pass the path, only the filename -->
<input type="text" id="fileName" name="fileName" size="150" style="display:none;"/>

Thanks for your excellent help

Geert
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 7

Expert Comment

by:RealSnaD
ID: 18882515
You're welcome. Glad I could help.
0
 

Expert Comment

by:ayeayemyo
ID: 21305428
Hi ya, I have the same problem, but I am using the file upload control as asp.net control with id="File1" and runat="server" tags.

I tried as you mentioned put the file path value into a hidden box or onClientClick, none of them is work of me. The following is my code and please anyone could help me out?

************ on form ****************
<label class="label">Header banner advert</label>
<input id="File1" type="file" name="fileUpload" runat="server" class="upload" size="50" title="Upload header banner advert" style="margin-bottom:5px;"/>

************ on .cs code *************
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            string filePath = File1.Value;
        }
0
 

Expert Comment

by:Elijen
ID: 22903727
Accepted solution doesn't work for me. FF (3.0.3) still alerts filename ONLY!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now