码迷,mamicode.com
首页 > 其他好文 > 详细

Upload file

时间:2014-07-09 20:30:29      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:blog   java   os   art   cti   for   

<h3>Upload  File</h3>
 
<form action="@Url.Action("Upload","UploadController")"  method="post" id="uploadForm" enctype="multipart/form-data">
    <div class="file-box">
        <input type="text" class="txt"/>  
        <input type="button" value="Browser" class="fileInputbtn"/> 
        <input type="file" class="fileInput" id="uploadFile" name="uploadFile"/>
        <input type="button" value="Upload" class="fileInputbtn" id="btnUpload"/>  
        <input type="button" value="Cancel" class="fileInputbtn" id="btnCancel"/>
    </div>
</form>

<script type="text/javascript">
    $(document).ready(function () {
        $(".fileInput").change(function () {
            $(".txt").val($(this).val());
        });

        $("#btnCancel").click(function () {
            $(".txt").val("");
        });

        $("#btnUpload").click(function () {
            var filePath = $(".txt").val();
            if (filePath.length == 0) {
                alert("Please upload a file.");
                return;
            }
            var extension = filePath.split(‘.‘).pop();
            if (extension != "xlsx") {
                alert("Please upload a correct file(.xlsx).");
                return;
            }

            $("input[type=‘button‘]").attr("disabled", "disabled");
            $(".button_01").attr("disabled", "disabled");
            $(".error").html("Uploading... please don‘t close the browser.");
            $("#uploadForm").submit();
        });
    });
</script>

  

Upload file,布布扣,bubuko.com

Upload file

标签:blog   java   os   art   cti   for   

原文地址:http://www.cnblogs.com/rebecca-ty/p/3830173.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!