开发者

Custom text for file input

开发者 https://www.devze.com 2022-12-20 07:16 出处:网络
Is there a 开发者_JS百科way to change the text on a a file input in html?This is the only possible solution i know of.There are two ways.

Is there a 开发者_JS百科way to change the text on a a file input in html?


This is the only possible solution i know of.


There are two ways.

Javascript

Flash

through javascript + css hack, you can do this as @Sarfaraz said. Another option is use flash. In that case you have more control.


That's not possible. That would have been a security hole. If that was possible, then everyone would be able to do this:

<form name="upload" action="upload" method="post" enctype="multipart/form-data">
    <input type="file" value="c:/passwords.txt">
    <input type="submit">
</form>
<script>document.upload.submit()</script>

True, you can mimic it with a plain input field as @sAc mentions, but it would still not point to the actual file.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号