473,602 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem when changing the name of browse... of <input type="file" tag

4 New Member
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:
[HTML]<input type="file" style=" width:100%" id="importFile " name="importFil e"/>
[/HTML]

As per our analysis we got two methods but none is satisfactory. Please let us know if there is any other way out

Method 1:

[HTML]<input type="file" onChange="chk.v alue=importFile .value;" style="display: none; width:100%" id="importFile " name="importFil e"/>
<input name="chk" id="chk" type="text" value="" />
<input type="button" i18n="buttons.c hooseFolder" onclick="import File.click()"/>
[/HTML]

The i18n attribute in the button tag gets the corresponding locale specific value from the property file & displays it on the HTML page. We have tried this method but we got an error “access denied.” And the form is not submitted to the server.

Method 2:
Expand|Select|Wrap|Line Numbers
  1.   <style type="text/css">
  2. div.fileinputs 
  3. {
  4.    position: relative;
  5. }
  6.  
  7. div.fakefile 
  8. {
  9.    position: absolute;
  10.    top: 0px;
  11.    left: 0px;
  12.    z-index: 1;
  13. }
  14.  
  15. input.file
  16.  {
  17.    position: relative;
  18.    text-align: right;
  19.    -moz-opacity:0 ;
  20.    filter:alpha(opacity: 0);
  21.    opacity: 0;
  22.    z-index: 2;
  23. }
  24.  
  25. </style>
  26. <body>
  27. <div class="fileinputs">
  28.    <input type="file" class="file"  onChange="chk.value=importFile.value;" id="importFile" name="importFile"/>
  29.    <div class="fakefile">
  30.                                     <input  name="chk"  id="chk" type="text" />
  31.               <input type="button" i18n="dashboard.buttons.chooseFolder"  style="width:75px"/>
  32.    </div>
  33. </div>
  34. </body>
  35.  
It’s ok. But when we resize the window it gives problem.


Thanks & Regards:

Sandeep Kumar
Oct 30 '08 #1
1 3295
acoder
16,027 Recognized Expert Moderator MVP
It seems as if you're using the CSS from this article. Have you tried the JavaScript version?
Oct 30 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
27864
by: Jesper Hermansen | last post by:
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:
1
10482
by: Matt | last post by:
When we click Browse button, <input type="FILE">, can we set the default of the directory to open?? For example, C:\MYFILES are open when the file open dialog is opened. please advise. thanks!!
2
28564
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!!
3
3085
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> I realize we couldn't set the default filename for security reasons, and browsers don't support that. (http://www.cs.tut.fi/~jkorpela/forms/file.html#value). I really need to implement this feature, any workarounds to the problem?
2
2076
by: HVG | last post by:
Hi, does anyone know why using ".click()" on a <INPUT type="file"> control should be a problem? - the html file selction control is on a very plain webform page with just the <input type="file"> control and a submit button. - the ".click()" method is simply used to automatically open the file selction dialog box so the user doesn't have to click "Browse". (likewise the form is automatically submitted when the user selects a file). The...
2
5653
by: IkBenHet | last post by:
Hello, I am uploading a file using this form in ASP.NET. I have also added a simpel textfield: <form runat="server" enctype="multipart/form-data"> <input type="file" id="oFile" Name="oFile" size="70" runat="Server"> <input type="text" SIZE="20" MAXLENGTH="20" id="Name" NAME="Name"> <input type="submit" id="Submit" runat="Server" value="Submit" OnServerClick="SubmitButton_Click"> </form>
4
4006
by: kevin | last post by:
Hi, I am trying to create a page so the user can browse the network, select a file and have that file name (text) inserted into our sql DB so I can build the hyperlink path later on. Here's what seems to be the problem. These are video files and are enormous with long crazy names so trying to hand type the file name in a text box is not an option. So I'm using an Input "file" control so when the user browses out onto the network...
1
19884
by: nad2zen | last post by:
Hi All, How to set the path value to file object using javascript. now i am trying to upload the file without using browse button, but i could not set the path value.. see my code: <form name="thisForm" enctype="multipart/form-data"> <table align="center"> <tr> <td align="left"><b>Select a file to upload :</b></td>
7
20858
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...
0
7993
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...
0
8401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8268
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...
1
5867
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
5440
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();...
1
2418
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
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.