Solved

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

Posted on 2007-04-06
6
12,487 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to count occurrences of each item in an array.

867 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

15 Experts available now in Live!

Get 1:1 Help Now