简体   繁体   English

并非所有浏览器都支持文件上传按钮

[英]file upload button not supported in all the browsers

I have created a file upload with search button at the right side. 我已经创建了带有搜索按钮的文件上传右侧。 This one is showing correctly in chrome only, but I need this to support all modern browsers. 该浏览器仅在chrome中正确显示,但是我需要它来支持所有现代浏览器。 I have tried in Mozilla where this is not being supported. 我曾在不支持此功能的Mozilla中尝试过。 Can anybody please help me to solve this. 谁能帮我解决这个问题。 Thank You. 谢谢。

 @import url(https://fonts.googleapis.com/css?family=Roboto); *, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } html { font-size: 16px } body { background-color: #fff; margin: 0; padding: 0; font-family: 'Roboto', sans-serif; font-size: 1rem; } .container { margin: 20px auto; max-width: 1140px; padding: 25px 25px; border: 1px solid #000; } .row { clear: both; } #myInput { width: 85%; border: 1px solid #000; display: inline-block; } input[type=file]::-webkit-file-upload-button { width: 0; padding: 0; margin: 0; -webkit-appearance: none; border: none; border: 0px; } x::-webkit-file-upload-button, input[type=file]:after { -webkit-appearance: button; border-collapse: separate; border-radius: 7px; -webkit-border-radius: 7px; -moz-border-radius: 7px; content: 'Search'; color: #080708; background: #e3e3e3; text-decoration: none; display: inline-block; left: 100%; margin-left: 50px; position: relative; padding: 10px 46px 10px 40px; } @media only screen and (max-width: 767px) { .container { width: 100%; padding: 15px; } #myInput { width: 64%; } .btn-View { width: 10%; } table td { padding: 12px; } } 
 <div class="container"> <div class="row"> <input type="file" name="myInput" id="myInput"> </div> </div> 

You can make it work in many ways. 您可以通过多种方式使其工作。

  1. The simple way if you do not need the file name to be seen, using the input file along with the label is the quickest way. 如果不需要显示文件名,最简单的方法是将输入文件与标签一起使用是最快的方法。

  2. Using the javascript can be handy. 使用javascript会很方便。 Go through these links for better understandings. 通过这些链接可以更好地理解。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM