Solved

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

Posted on 2007-04-06
6
12,500 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
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…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

809 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