Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

input type=file 1

Status
Not open for further replies.

shultz

Programmer
Oct 28, 2001
42
HK
Hi,

the syntax

<INPUT TYPE=FILE id=lfPath name=lfPath class=inpbox>

gives me an input box and a button labelled &quot;browse&quot; next to it. Can I by any means change that label to say &quot;...&quot;

Thanks.
 
NO you can't change the style of the real browse button, but there is a workaround! :)
Set the style of the <input> tag to 'display:none' and make a fake button and inputfield that will do the work

Try this example !! The only disadvantage is that you are not allowed to change the location of the file to be uploaded simply by editing the value of the text field (that's why its DISABLED attribute is set).

<HTML>
<HEAD>
<TITLE>Customizing INPUT TYPE=FILE Appearance</TITLE>
</HEAD>
<BODY>
<INPUT TYPE=&quot;file&quot; ID=&quot;fileUpload&quot; STYLE=&quot;display:none&quot;
onChange=&quot;textFilename.value = this.value;&quot;>
<INPUT TYPE=&quot;text&quot; ID=&quot;textFilename&quot; STYLE=&quot;FONT-FAMILY:arial;FONT-SIZE:9pt&quot;
SIZE=&quot;40&quot; DISABLED>
<INPUT TYPE=&quot;button&quot; ID=&quot;btnBrowse&quot; STYLE=&quot;FONT-FAMILY:arial;FONT-SIZE:9pt;
BACKGROUND-COLOR:lightblue&quot; onClick=&quot;fileUpload.click()&quot;
VALUE=&quot;Choose a File&quot;>
</BODY>
</HTML>

Hope this helps,
Erik <-- My sport: Boomerang throwing !!
!! Many Happy Returns !! -->
 
hey guys, thanks vey much for the help. the last link really helped me. :)
 
The &quot;solution&quot; given above works for IE only!! Any chance of getting a REAL solution to the problem?
 
My problem....
How can I find out the value of file object ????
I put this code in a form with method=get but the fileUpload return nothing
If I put name=&quot;fileUpload&quot; in <intput type=file> TAG
the script isn't work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top