<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的更多相关文章

  1. 页面无刷新Upload File

    页面无刷新Upload File. 利用jquery.form.js的ajaxForm提交文件. 具体参考以下代码: 前台html <%@ Page Language="C#" ...

  2. jQuery文件上传插件jQuery Upload File 有上传进度条

    jQuery文件上传插件jQuery Upload File 有上传进度条 jQuery文件上传插件jQuery Upload File,插件使用简单,支持单文件和多文件上传,支持文件拖拽上传,有进度 ...

  3. Angular HttpClient upload file with FormData

    从sof上找到一个example:https://stackoverflow.com/questions/46206643/asp-net-core-2-0-and-angular-4-3-file- ...

  4. Express web框架 upload file

    哈哈,敢开源,还是要有两把刷子的啊 今天,看看node.js 的web框架 Express的实际应用 //demo1 upload file <html><head><t ...

  5. apache php upload file

    /********************************************************************************* * apache php uplo ...

  6. fetch API & upload file

    fetch API & upload file https://github.com/github/fetch/issues/89 https://stackoverflow.com/ques ...

  7. 通过iframe 实现upload file无刷新

    <html>    <head> </head> <body> <form encType="multipart/form-data&q ...

  8. post upload file & application/x-www-form-urlencoded & multipart/form-data

    post upload file application/x-www-form-urlencoded & multipart/form-data https://stackoverflow.c ...

  9. power shell upload file to azure storage

    # Azure subscription-specific variables. $storageAccountName = "storage-account-name" $con ...

随机推荐

  1. java线程的简单实现及方法

    java线程: 线程是一个程序内部的顺序控制流. cpu实际上在一个时间点上,只执行一个.只不过我们把cpu分成了多个时间片,由于速度很快,我们看起来像是多个线程.. 就像你的时间分成几片,这样 整体 ...

  2. insertAfter的兼容性

    function insertAfter(newElement,targetElement){    var parent=targetElement.parentNode;    if(parent ...

  3. php继承后构造函数的特性

    在5.x版本的php中: 如果父类有构造函数,它的子类也有构造函数,那么在运行子类时就“不会执行父类的构造函数”. 要想执行父类的构造函数,需要在子类的构造函数中加上: parent::__const ...

  4. Xss里img标签的一些利用

    <img src=x onerror=with(document)body.appendChild(document.createElement('script')).src="//x ...

  5. java web重定向与转发

    首先定义一下这两个词: 重定向是将用户从当前页面或servlet定向到另外一个jsp页面或者servlet 转发是将用户对当前jsp页面或者servlet对象的请求转发给另外一个jsp页面或者serv ...

  6. IOS第14天(1,UITabBarController的基本的使用)

    **************HMAppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWit ...

  7. IOS第二天

    第二天 *******图片的放大,和缩小 (去掉自动的布局) -(IBAction ) zoomFrame:(UIbutton *) button{ CGRect frame= self.iconBu ...

  8. LaTex 基础

    一.文档 \documentclass{article} %book, report, letter 二.宏包 \usepackage{amsmath} 三.正文 \begin{document} \ ...

  9. Oracle-01033错误处理

    今天电脑非常卡,强制重启后,发现oracle 11g启动不了了,提示错误: ERROR - ORA-01033 oracle initialization or shutdown in progres ...

  10. jquery 图片本地预览

    uploadPreview.js /* *名称:图片上传本地预览插件 v1.1 *介绍:基于JQUERY扩展,图片上传预览插件 目前兼容浏览器(IE 谷歌 火狐) 不支持safari *参数说明: I ...