Solved

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

Posted on 2007-04-06
6
12,529 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to size popup in jquery mobile 4 65
Check if field exists SPUtility 5 48
Difference between Leaflet and MapBox? 5 47
Doubt with angularJs with PHP 4 22
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

710 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