473,748 Members | 10,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get '<input type="file">.va lue' with Internet Explorer

Hi!

I'm making a system that will generate Winamp-playlists.
To make it easy for the user to add a file to the list, I'm using <input
type="file">.

The problem with this is that I only get the filename, not the path,
which is necessary in my situation.

I cracked the problem in Firefox:

<snip>
function get_id ($id) {
if (document.all && document.getEle mentById) {
return document.all($i d);
} else if (!document.all && document.getEle mentById) {
return document.getEle mentById($id);
} else {
return false;
}
}
function fullpath () {
$file = get_id('file');
$hiddenfile = get_id('hiddenf ile');
$hiddenfile.val ue = $file.value;
}

<form action="save.ph p" method="post" onsubmit="fullp ath();">
File: <input id="file" type="file" />
<input type="hidden" name="file" id="hiddenfile " />
<input type="submit" value="Add" />
</form>

</snip>

But this doesn't seem to work in Internet Explorer and Opera...

Is there another way to get the absolute path from an <input type="file"> ??
Jul 23 '05 #1
1 27902
What Hermansen :o)

I'm not the only Dane using this group :o)

the answer is document.FORMNA ME.ELEMENTNAME. value
Spam again :o)

"Jesper Hermansen" <no@spam.com> wrote in message
news:40******** *************@d read11.news.tel e.dk...
Hi!

I'm making a system that will generate Winamp-playlists.
To make it easy for the user to add a file to the list, I'm using <input
type="file">.

The problem with this is that I only get the filename, not the path,
which is necessary in my situation.

I cracked the problem in Firefox:

<snip>
function get_id ($id) {
if (document.all && document.getEle mentById) {
return document.all($i d);
} else if (!document.all && document.getEle mentById) {
return document.getEle mentById($id);
} else {
return false;
}
}
function fullpath () {
$file = get_id('file');
$hiddenfile = get_id('hiddenf ile');
$hiddenfile.val ue = $file.value;
}

<form action="save.ph p" method="post" onsubmit="fullp ath();">
File: <input id="file" type="file" />
<input type="hidden" name="file" id="hiddenfile " />
<input type="submit" value="Add" />
</form>

</snip>

But this doesn't seem to work in Internet Explorer and Opera...

Is there another way to get the absolute path from an <input type="file">

??
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7510
by: Bhavin | last post by:
Hi I'm trying to set default value for input type file. <input type="File" name="tx_pdffile" accept="*.pdf" class="boxText" value="abc.pdf"> but this value (abc.pdf) doesnt appear in the text box.. Whats the solution???
2
28576
by: Matt | last post by:
If I do the following, the browse text box still cannot see C:/hello world/test.txt. <input type="file" name="fileName" value="C:/hello world/test.txt" size=80> Any ideas? and workarounds to this problem? thanks!!
2
8125
by: Laermans_k | last post by:
Hi, Does anyone have a solution to use the <input type="file" id="filechooser"> and the <input type="submit" id="submitbutton"> in 1 button click? I've already tried to create a javascript function behind the submitbutton click. In this function i call the filechooser.click() event and after this i call the functions to activate the progressbar of the upload. This doesn't seems to work:(
7
2674
by: Drew Berkemeyer | last post by:
I've encounted a pretty strange problem and I'm not quite sure what to make of it. I have a web service that consumes an XML file as well as a few other parameters. This web service works fine if I use the web test interface. It also works fine if I call it from an ASP.NET page that has a text box where the XML is pasted and then passed on. However, I get an exception if I use an <input type="file"> control on the ASP page that allows...
2
3826
by: Tarkeshwar | last post by:
Hi All, I want to restrict the user from being entering the value in <input type="file">. It works fine in IE but not in Mozilla. I am sending my code also which works in IE and not in Mozilla.Can anybody have the solution. Thanks in advance. code :
7
20869
by: Tim Slattery | last post by:
I'm trying to handle the onChange event in an <input type="file"> element. In IE, there's no problem: the event fires when a file in the "open" box is doubleclicked, or the "Open" button in the box is clicked, or "Enter" is hit in the attached text box. I can get the value of the element. But in Netscape 7, onChange doesn't fire until focus leaves the element. When you double-click a file name or click "open" in the Open box, the...
3
4374
by: eeeeman | last post by:
This one has really got me! Im trying to write a value to a input type="file" form element using client-side javascript. I have tried the obvious, simply writing: <input type="file" name="filebox" value="myvalue"> ..doesnt work (ok I sound like a newbie) I have tried: document.formUpload.filebox.value = "myvalue"
1
14035
by: ChollaPete | last post by:
This code: <form action="processScan.php" method="get"> <p> <?php print "Scan name: <input type=\"file\" name=\"tScanFileName\" value= \"{$scanFileName}\"><br>"; addHiddenCarryons(); ?> <input type="submit">
1
3314
by: sandeep kumar shah | last post by:
Hi, We have used a file uploading HTML tag in an HTML page. We need to customize the text displayed on the Button (which is by default “Browse…” for internet explorer). Below is the code we have used: CODE: <input type="file" style=" width:100%" id="importFile" name="importFile"/> As per our analysis we got two methods but none is satisfactory. Please let us know if there is any other way out
0
8984
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9238
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.