繁体   English   中英

更改文件按钮名称和描述

[英]Change the file button name and description

我在视图中使用以下代码创建文件上传器功能。 这将创建一个按钮,单击该按钮可打开文件资源管理器。
我需要将按钮名称从默认名称“ 选择文件”更改为其他名称,同时也选择无文件”

    <div class="form-group">
        @Html.LabelFor(model => model.Cert, new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            <input type="file" />
        </div>
    </div>

你可以试试这个

<form method="POST" action="myurl"> <span class="btn btn-success fileinput-button">
        <span>Select file</span>

    <input type="file" name="file">
    </span>
</form>


/*Copied from bootstrap */
 .btn {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: normal;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
}
/*Also */
 .btn-success {
    color: #fff;
    background-color: #5cb85c;
    border-color: #4cae4c;
}
/* This is copied from https://github.com/blueimp/jQuery-File-Upload/blob/master/css/jquery.fileupload.css */
 .fileinput-button {
    position: relative;
    overflow: hidden;
}
/*Also*/
 .fileinput-button input {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    opacity: 0;
    -ms-filter:'alpha(opacity=0)';
    font-size: 200px;
    direction: ltr;
    cursor: pointer;
}

http://jsfiddle.net/X3S4a/上的工作示例

暂无
暂无

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

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