Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-04-06
6
Medium Priority
?
12,553 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:Yury Merezhkov
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:
Yury Merezhkov earned 2000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 7

Expert Comment

by:Yury Merezhkov
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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 …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

730 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