Normally, a file upload dialog is invoked by clicking the button created by <input type="file"/>
. But then, I don't want the text field that comes with it. Is there a way to get rid of the text field? Or is there an alternative way to open the file upload dialog without using <input/>
?
views:
110answers:
6
+1
A:
You can use a flash alternative. I have used swfUpload, with great success. Uploadify, is a similar alternative. Both of these have nice feature sets, including progress bars and multiple upload.
Dustin Laine
2010-10-18 02:38:24
+1
A:
You could replace it with a flash-button as dustin stated or you could hide the button by css-placing your own button on top of the input element and open the select file box by a script.
Some examples here: inputfile
Simon Karlsson
2010-10-18 02:44:38
+1
A:
Add file input, and set its position to quite far away.
Add a button.
Set buttons onclick to $("#myFile").click();
:D
<input id="myFile" name="file" type="file" style="position:absolute;left:-10000px;top:-10000px;">
<button onclick="$('#myFile').click();">Browse</button>
feridcelik
2010-10-18 02:56:49
I'm pretty sure that doesn't work for security reasons.
alex
2010-10-18 02:58:32
Did you try? works on Chrome.
feridcelik
2010-10-18 03:01:10
It works on Chrome and IE but breaks in Opera and Firefox.
Dave
2010-10-18 03:47:06
@eridcelik Yes, I tried it with Firefox a few weeks back.
alex
2010-10-18 12:07:47
+1
A:
You can add your own button and position it under the browse button with CSS.
Then set the file input to have 0 opacity.
alex
2010-10-18 02:59:02
+1
A:
agree with alex
<style>
.file_wrap{
background:url(file.jpg);
overflow:hidden;
width:30px;
height:10px;
}
.file_wrap input{
opacity:0;
font-size:999px;
cursor:pointer;
}
</style>
<div class="file_wrap">
<input type="file" />
</div>
diablero13
2010-10-18 03:28:47