I want to write a program using simple html input type="text" and a button which will does the functionality of input type="file".
-
You can make the file input hidden and make the button trigger the file's onclick. It works, but it is a lot of effortLeandro Barreto– Leandro Barreto2012-12-06 09:21:31 +00:00Commented Dec 6, 2012 at 9:21
-
1My guess is that you want a styled file input. If that's the case, see here: stackoverflow.com/questions/3226167/…Madara's Ghost– Madara's Ghost2012-12-06 09:25:52 +00:00Commented Dec 6, 2012 at 9:25
Add a comment
|
2 Answers
HTML From :
<input type="file" class="file">
<input type="text" name="file" class="sfile">
<input type="submit" value="send file" name="submit">
css :
.file{
visibility:hidden; # don't use display:none; because IE compability in js
}
jQuery :
$('.sfile').click(function(){
$('.file').click();
});
$('.file').change(function(){
$('.sfile').val($(this).val());
});