HTML文件选择器(输入类型=“文件”)按钮无法在Chrome浏览器中正确显示

时间:2011-08-10 08:39:46

标签: html browser html-form

我在index.php文件中有一个html文件选择器。下面给出了代码

//index.php (This is just an example)
<form enctype="multipart/form-data" action="http://myserver/abc/upload.php" method="POST">
      Select image to upload :     
      <input name="photo" type="file" size="30" width="250">          
      <input type="submit" value="Upload"/>
</form>

在firefox浏览器中,我可以看到带有文本字段(显示文件路径)的文件选择器和名为&#39;浏览&#39;(作为普通文件选择字段)的按钮
但是在Chrome浏览器中我无法看到文本字段。按钮名称是&#39;选择文件&#39;不是&#39;浏览&#39;。
我该如何解决这个问题? 我需要在所有浏览器中显示它,因为它在firefox浏览器中显示

2 个答案:

答案 0 :(得分:1)

没有标准的自定义文件输入样式的方法,但你可以找到大量的css / js技巧。使用关键字:custom css file input

答案 1 :(得分:0)

通过添加此内联样式更改文件类型

<input name="photo" type="file" size="30" width="250" style="line-height:0;">