File upload and localization

liunx

Guest
I am developing a website that needs to be localized. I use the <input type=file> to allow the users to upload files.<br />
<br />
How the control is displayed depends on the browser. In Explorer on Mac I see a text field and a submit button names 'Browse...'. Apple's browser Safari displays a submit button named 'Choose File' and the initial string 'no file selected'.<br />
<br />
My question is how I get control of the title of the submit buttons and the initial text displayed?<!--content-->There is a work round for this for IE which requires using a seperate text and button and hiding the file input.<br />
<br />
Please try the 2 versions below, one uses buttons whilst the other uses image.<br />
<br />
I do not have mac so I don't know if this works on it<br />
<br />
<br />
<br />
<br />
<script language="javascript"><br />
<!--<br />
function upload(){<br />
which_image1=document.f1.image_file1.value<br />
if(which_image1==""){<br />
return<br />
}<br />
else{<br />
document.image2.src=http://www.webdeveloper.com/forum/archive/index.php/which_image1<br />
}<br />
}<br />
// --><br />
</script> <br />
<br />
<form name="f1"><br />
<input name="image_file1" type="file" style="display:none" onchange="txt1.value=this.value"> <br />
<input type="text" name="txt1"> <br />
<input type="button" value="Show me what you've got dude" onclick="image_file1.click()"> <br />
<input type="button" value="I'll take it" onclick="upload()"> <br />
</form><br />
<br />
<br />
<img name="image2" src=http://www.webdeveloper.com/forum/archive/index.php/""> <br />
<br />
<script language="javascript"><br />
<!--<br />
function upload2(){<br />
which_image2=document.f2.image_file2.value<br />
if(which_image2==""){<br />
return<br />
}<br />
else{<br />
document.image2.src=http://www.webdeveloper.com/forum/archive/index.php/which_image2<br />
}<br />
}<br />
// --><br />
</script> <br />
<br />
<form name="f2"><br />
<input name="image_file2" type="file" style="display:none" onchange="txt2.value=this.value"> <br />
<input type="text" name="txt2"> <br />
<input type="image" src=http://www.webdeveloper.com/forum/archive/index.php/"pic1.jpg" onclick="image_file2.click(); return false"> <br />
<input type="image" src=http://www.webdeveloper.com/forum/archive/index.php/"pic2.jpg" onclick="upload2();return false"> <br />
</form><!--content-->
 
Back
Top