Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » Change Text button in input file


Change Text button in input file

Reply
  #1 (permalink)  
Old 07-25-08, 01:48 AM
Amit Rathi's Avatar
Amit Rathi Amit Rathi is offline
New Member
 
Join Date: Jul 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Change Text button in input file

How I can change the [Browse..] text of button in case of input file field..


example :
HTML Code:
<input type="file" name="file">

Amit Rathi

Last edited by Nico; 07-25-08 at 03:50 AM. Reason: Removed URL.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-25-08, 02:02 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
Its afaik impossible to do.
found this but that apparently only works for IE6/7, FF3/Opera 9/Safari 3 doesnt support it.
Tested on Vista Ultimate.

Last edited by <?Wille?>; 07-25-08 at 02:05 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 07-25-08, 02:26 AM
Amit Rathi's Avatar
Amit Rathi Amit Rathi is offline
New Member
 
Join Date: Jul 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
I got some solution for this.

HTML Code:
<form name=eee>
<input type = file name = browse style = 'display:none'>
<input name = file_name>
<input type = button onclick = 'document.eee.browse.click();document.eee.file_name.value = document.eee.browse.value;' value="dslsdfdsf">
</form>
But document.eee.browse.click() does not works with firefox.

If anybody have some Idea...

Amit Rathi

Last edited by Nico; 07-25-08 at 03:50 AM. Reason: Removed URL.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 07-29-08, 11:50 AM
ianbrind ianbrind is offline
Wannabe Coder
 
Join Date: Jul 2008
Location: Somerset UK!
Posts: 192
Thanks: 0
Thanked 0 Times in 0 Posts
Umm save the file name as a string. Mess around with it through php then send the new string as header info...?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 08-06-08, 01:33 PM
drale's Avatar
drale drale is offline
Newbie Coder
 
Join Date: Jul 2003
Location: indiana
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
I found a solution you might try. There is a lot of explanation and code here but I'll post some of it.
It makes use of another input box laying on top of your browse box and some javascript and css tricks.

1. Take a normal <input type="file"> and put it in an element with position: relative.
2. To this same parent element, add a normal <input> and an image, which have the correct styles. Position these elements absolutely, so that they occupy the same place as the <input type="file">.
3. Set the z-index of the <input type="file"> to 2 so that it lies on top of the styled input/image.
4. Finally, set the opacity of the <input type="file"> to 0. The <input type="file"> now becomes effectively invisible, and the styles input/image shines through, but you can still click on the "Browse" button. If the button is positioned on top of the image, the user appears to click on the image and gets the normal file selection window.
(Note that you can't use visibility: hidden, because a truly invisible element is unclickable, too, and we need the <input type="file"> to remain clickable)

The rest is at: http://www.quirksmode.org/dom/inputfile.html (I'm not affiliated with this site, I find it through google, first result for "style file browse field in HTML")
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using data stored in a text file Philmo PHP 3 04-08-08 02:20 PM
Search script improvement 9999 PHP 14 08-29-06 12:46 AM
reading text from a file waji ASP 2 11-10-04 12:41 AM
Excel document containing records, need to save as a text file to upload to mysql bearslife PHP 1 06-05-04 04:24 AM
Writes to a text file gamextremer2003 JavaScript 4 09-11-03 10:43 AM


All times are GMT -5. The time now is 09:13 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.