rlecjr
April 9th, 2002, 04:11 PM
I see on various websites.. where you click a browse button and the 'Choose file' dialog box appears for you to select the location that you wish to either grab or store a file. Can anyone lead me to an example on how to code this?? Any help ASAP would be extremely appreciated!
Thanks,
Ron
mjxnjx
April 11th, 2002, 01:45 PM
Here's an example of some javascript on how to browse for files on your local drive. This does some validation and lets you preview the file as well.
<HTML><HEAD>
<SCRIPT LANGUAGE='JavaScript'>
function whatFile()
{
window.open('file:///' + document.form1.cmuds.value);
}
function checkFile()
{
tmp=document.form1.cmuds.value;
if (tmp.length<1)
{
alert('Please enter a file to upload before continuing')
document.form1.cmuds.focus();
}
}
</script>
</HEAD>
<BODY>
<p><center>
<form method='POST' focus='cmuds' name=form1 enctype='multipart/form-data'>Please Select the File you wish to Upload.<BR><BR>
<input type='file' name='cmuds' size=50>
<input type='button' onClick='whatFile()' value='Preview'>
<input type=submit name='uploadit' value='Upload It' OnClick='checkFile()'>
</form></body></html>
<i>You know that rating you've been holding onto? Now is a great time to use it!</I>