做手机微信,给type=file按钮默认样式改成一张图片,点击上传的时候,有问题 。
贴代码:
<div class="security">
<input id="upload" class="pic" type="file" placeholder="上传安全风险图片" onchange="checkpic('upload');" value="" name="upload">
<img src="images/image_fi.png" alt=""/>
</div>
样式:
.security{height:36px;margin:0 auto;position:relative;}
.security input.pic{left:5px;top:0;width:120px;height:34px;padding-left:5px;cursor:pointer;opacity:1.0;font-size:0;}
.security img{width:120px;height:34px;}
这样做目的就是把input设置为透明,但是当选着一个文件点击确定上传的时候,确无法显示你上传的路径或者上传图片的小图。怎么解决。默认的file效果确是有的。
<input type="file" id="browsefile" style="visibility:hidden" onchange="filepath.value=this.value">
<input type="button" id="filebutton" value="" onclick="browsefile.click()">
<input type="textfield" id="filepath">
这样写就实现效果了
安卓内置浏览器默认阉割掉了input[type=file],所以无法上传文件。不知道你用的ios还是安卓。