<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. [LintCode] Create Maximum Number 创建最大数

    Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum numb ...

  2. ado.net 完整修改删除,攻击防攻击

    完整修改和删除:当你输入了要删除的用户名,先提示有没有此条数据 先查 后删/后改------------ using System; using System.Collections.Generic; ...

  3. JAVA生成二维码图片代码

    首先需要导入 QRCode.jar 包 下载地址看这里   http://pan.baidu.com/s/1o6qRFqM import java.awt.Color;import java.awt. ...

  4. js原型对象与Java类的比较

    在我学习Javascript的原型对象时,我总是不自觉地拿Java的类思想来做比较,时间久了,我渐渐认识到二者有巨大的不同. 首先,类是不能直接当方法来运行,它最简便的方式是调用其静态方法:而原型对象 ...

  5. ArcEngine:空间索引格网大小无效

    参考如下帖子:http://www.cnblogs.com/linhugh/archive/2012/07/24/2606439.html\ C# 代码如下 IFeatureClass pNewFtC ...

  6. javascript中判断对象类型

    <script type="text/javascript"> //判别一个对象属性在不在某个对象中 //in 是用于查找某个属性是否存在于对象中,它会把对象 //里面 ...

  7. 关于百度分享——bdCustomStyle一点bug

    最近碰到一个项目,因为用上百度分享,出现了奇怪的bug. 具体是,当访问JSP页面时,js脚本会执行一次,而java脚本执行了两次. 最后排查发现是百度分享js脚本的问题,把"bdCusto ...

  8. iOS Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.30.14/UITableView.m:7962

      Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/Cac ...

  9. Final-阶段站立会议2

    组名:天天向上 组长:王森 组员:张政.张金生.林莉.胡丽娜 代码地址:HTTPS:https://git.coding.net/jx8zjs/llk.git SSH:git@git.coding.n ...

  10. js弹窗

    常用人JS弹窗,lhgDialog 4.20