我们都熟悉html的file属性。在浏览器中,我们看到一个带有文本“浏览”和“未选择文件”文本的按钮。
如何在浏览按钮附近编辑文本“未选择文件”?
实际上,我想要做的是,用户打开该表单,通过该输入上传并提交文件,然后该文件存储在数据库中。用户打开相同表单时刷新页面后,应显示以前上传的文件的名称,而不是“未选择文件”。我怎么做。搜索了很多,但一无所获,我对此一无所知,所以没有尝试过任何东西。任何帮助,将不胜感激。提前致谢。
https://stackoverflow.com/a/7691323/6588826也许这可以帮助您
您可以在此处尝试一个有效的示例:http : //jsfiddle.net/VQJ9V/307/(在FF 7,IE 9,Safari 5,Opera 11和Chrome 14中测试)
<div class="inputWrapper">
<input class="fileInput" type="file" name="file1"/>
.inputWrapper {
height: 32px;
width: 64px;
overflow: hidden;
position: relative;
cursor: pointer;
/*Using a background color, but you can use a background image to represent a button*/
background-color: #DDF;}
.fileInput {
cursor: pointer;
height: 100%;
position:absolute;
top: 0;
right: 0;
z-index: 99;
/*This makes the button huge. If you want a bigger button, increase the font size*/
font-size:50px;
/*Opacity settings for all browsers*/
opacity: 0;
-moz-opacity: 0;
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0)}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句