473,386 Members | 1,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

file field

Hi,
In the file field <input type="file" name="file1">, can I modify the button
"Browse..."?
I want to hide the file field but show a button like "Open". When I click on
this button, it catches a file, and use onchange even to upload this file.
thanks for any idea.
Atse

Jul 19 '05 #1
4 3940
I'm afraid you can't modify that button in current browsers

IIRC, though, there are tricks you can do with CSS layers which might be
able to mask it...
--
Atrax, MVP, IIS

http://rtfm.atrax.co.uk/

"atse" <du******@yahoo.com> wrote in message
news:oo**********************@news01.bloor.is.net. cable.rogers.com...
Hi,
In the file field <input type="file" name="file1">, can I modify the button "Browse..."?
I want to hide the file field but show a button like "Open". When I click on this button, it catches a file, and use onchange even to upload this file.
thanks for any idea.
Atse

Jul 19 '05 #2
Hi, Atse

Please see the code bellow. It uses customized button, you can also use
an image or other HTML element to browse files.
There is one difference with this code and plain type=file field -
client must select file from browse window, cannot copy full path to the
text field.
Antonin
See Pure/Huge ASP upload (http://www.pstruh.cz) to accept uploaded file
in ASP :-)

<HTML>
<HEAD>
<TITLE></TITLE>
<Script Language='Javascript'>
function validateFile()
{
document.frm.Image.click();
var sTmpString = new String(document.frm.Image.value);

var iPos = sTmpString.lastIndexOf("\\");

document.frm.txt.value = sTmpString.substring(iPos+1,sTmpString.length);

}
</Script>
</HEAD>
<BODY>
<form name="frm">
<input type="file"
name="Image" size="20"
onChange="validateFile();" style="visibility:hidden;">
<input type="text" name="txt">
<input type="button" value="Browse ..."
onMouseDown="validateFile();">
</form>
</BODY>
</HTML>

"atse" <du******@yahoo.com> wrote in message
news:oo**********************@news01.bloor.is.net. cable.rogers.com...
Hi,
In the file field <input type="file" name="file1">, can I modify the button "Browse..."?
I want to hide the file field but show a button like "Open". When I click on this button, it catches a file, and use onchange even to upload this file.
thanks for any idea.
Atse

Jul 19 '05 #3
Thanks Antonin, but it doesn't work for me, because no file is passed to
upload. I enable Image's visibility, and found the path there. When I click
on the submit button once, the path is clear on the Image field, and the
form doesn't submit. In another word, click once the submit button, the form
doesn't submit, but the Image field is clear the path. Any idea?
atse

"Antonin Foller" <an*****@foller.cz> wrote in message
news:u%****************@TK2MSFTNGP12.phx.gbl...
Hi, Atse

Please see the code bellow. It uses customized button, you can also use an image or other HTML element to browse files.
There is one difference with this code and plain type=file field -
client must select file from browse window, cannot copy full path to the
text field.
Antonin
See Pure/Huge ASP upload (http://www.pstruh.cz) to accept uploaded file in ASP :-)

<HTML>
<HEAD>
<TITLE></TITLE>
<Script Language='Javascript'>
function validateFile()
{
document.frm.Image.click();
var sTmpString = new String(document.frm.Image.value);

var iPos = sTmpString.lastIndexOf("\\");

document.frm.txt.value = sTmpString.substring(iPos+1,sTmpString.length);

}
</Script>
</HEAD>
<BODY>
<form name="frm">
<input type="file"
name="Image" size="20"
onChange="validateFile();" style="visibility:hidden;">
<input type="text" name="txt">
<input type="button" value="Browse ..."
onMouseDown="validateFile();">
</form>
</BODY>
</HTML>

"atse" <du******@yahoo.com> wrote in message
news:oo**********************@news01.bloor.is.net. cable.rogers.com...
Hi,
In the file field <input type="file" name="file1">, can I modify the button
"Browse..."?
I want to hide the file field but show a button like "Open". When I click on
this button, it catches a file, and use onchange even to upload this

file. thanks for any idea.
Atse


Jul 19 '05 #4
Tom
Yes, the browser doesn't allow this. Although you might be able to
hide the input with a layer or something, you won't be able to pre-set
the file that you want uploaded. You need to use an applet or other
client control like ActiveX to supplement the browser security
limitations.
-Tom
"Atrax" <at***@dontspamatrax.co.uk> wrote in message news:<u3**************@TK2MSFTNGP09.phx.gbl>...
I'm afraid you can't modify that button in current browsers

IIRC, though, there are tricks you can do with CSS layers which might be
able to mask it...
--
Atrax, MVP, IIS

http://rtfm.atrax.co.uk/

"atse" <du******@yahoo.com> wrote in message
news:oo**********************@news01.bloor.is.net. cable.rogers.com...
Hi,
In the file field <input type="file" name="file1">, can I modify the

button
"Browse..."?
I want to hide the file field but show a button like "Open". When I click

on
this button, it catches a file, and use onchange even to upload this file.
thanks for any idea.
Atse

Jul 19 '05 #5

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

Similar topics

3
by: Karen Grube | last post by:
Hi! Each week, we receive a two-page PDF file from UPS along with a separate flat file (a CSV) The PDF file contains the overview of our weekly invoice and the CSV contains the details of each...
1
by: Monte Chan | last post by:
Hi all, I have the following codes, <script language="JavaScript"> function check_stuff(field) { alert("blank out the field now"); field.value = ""; } </script>
2
by: Robert | last post by:
I have the XML file which has a structure similar to one I pasted at the end of this post. As you can see many elements are using different id attributes. For example element Window uses WinID...
8
by: yinjennytam | last post by:
Hi all, I'm new to .NET and XML and I have a question. Given an XML file, I want to navigate its content and look for one or two particular elements to get their values. At this point, it...
4
by: kev | last post by:
Hi folks, I have created a database to store information on equipments. During the first level of registration, there is a form that i need the user to fill up details on the equipment testing....
6
by: Richard | last post by:
Which way would you guys recommened to best parse a multiline file which contains two fields seperated by a tab. In this case its the linux/proc/filesystems file a sample of which I have included...
2
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
8
by: Tommy Grav | last post by:
I have a file with the format Field f29227: Ra=20:23:46.54 Dec=+67:30:00.0 MJD=53370.06797690 Frames 5 Set 1 Field f31448: Ra=20:24:58.13 Dec=+79:39:43.9 MJD=53370.06811620 Frames 5 Set 2...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...

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.