<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. 在MySql 5.0 的表里同时添加两个自动更新的timestamp字段

    create table user_info (user_id int primary key auto_increment, register_time timestamp not null DEF ...

  2. JS原型探索小记(一)

    最近,我学习了jquery的源码,有个很深的认识就是——当对js的基本语法和面向对象思维了解比较熟悉之后,js真正的精髓在通过阅读一些优秀的框架源码也显现出来,我个人总结为对原型(原型链)和闭包两个基 ...

  3. Hibernate saveOrUpdate方法到底是怎么执行的?

    saveOrUpdate方法,如果传入的对象有主键就执行更新,没有就执行新增.这句话误导了很多人. 究竟是执行新增还是更新,是要有上下文环境的.这个环境就是主键策略的选择. 主键生成方式为 手动设置: ...

  4. Mysql的一些常用命令

    Mysql基本操作 创建表: create table test01_02(id varchar(50) not null auto_increment primary key, name nvarc ...

  5. iOS 导入第三方文件夹时右侧出现问号

    首先,和版本库有关. a代表add,m代表modify,?代表未能识别,通常如果使用git之类的版本控制器,添加文件后没有进行提交,就会出现? 1.遇到引用文件夹为蓝色的情况,是你以为勾了copy项, ...

  6. css - float浮动模块的高度问题 解决方案

    当一个Div中的子元素都是浮动元素时,该div是没有高度的.通常会带来很多困扰,解决方案如下: 低版本统配兼容: overflow: hidden; 下面是不支持低配浏览器,而且似乎该效果对 P 标签 ...

  7. BizTalk动手实验(一)安装BizTalk Server 2010开发环境

    1 课程简介 通过本课程了解BizTalk 2010的软依赖及基本的安装配置步骤,BizTalk相应的解决方案及高可用性方案可在课程的基础进行深入学习. 2 准备工作 硬件环境:CPU >2.0 ...

  8. token原理

    token原理1.和session有很大关系哦. jsp生成表单时,在表单中插入一个隐藏<input>字段,该字段就是保存在页面端的token字符串,同时把该字符串存入session中.等 ...

  9. RDS MySQL 连接数满情况的处理

    RDS MySQL 连接数满情况的处理 RDS MySQL 连接数满有2种情况 1. 空闲连接过多 原因: 应用使用长连接模式 - 对于长连接模式(比如Java应用),应用侧应该配置连接池.连接池的初 ...

  10. java notify和notifyAll的区别

    首先从名字可以了解,notify是通知一个线程获取锁,notifyAll是通知所有相关的线程去竞争锁. notify不能保证获得锁的线程,真正需要锁,并且可能产生死锁. 举例1: 所有人(消费者线程) ...