Upload file
<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的更多相关文章
- 页面无刷新Upload File
页面无刷新Upload File. 利用jquery.form.js的ajaxForm提交文件. 具体参考以下代码: 前台html <%@ Page Language="C#" ...
- jQuery文件上传插件jQuery Upload File 有上传进度条
jQuery文件上传插件jQuery Upload File 有上传进度条 jQuery文件上传插件jQuery Upload File,插件使用简单,支持单文件和多文件上传,支持文件拖拽上传,有进度 ...
- Angular HttpClient upload file with FormData
从sof上找到一个example:https://stackoverflow.com/questions/46206643/asp-net-core-2-0-and-angular-4-3-file- ...
- Express web框架 upload file
哈哈,敢开源,还是要有两把刷子的啊 今天,看看node.js 的web框架 Express的实际应用 //demo1 upload file <html><head><t ...
- apache php upload file
/********************************************************************************* * apache php uplo ...
- fetch API & upload file
fetch API & upload file https://github.com/github/fetch/issues/89 https://stackoverflow.com/ques ...
- 通过iframe 实现upload file无刷新
<html> <head> </head> <body> <form encType="multipart/form-data&q ...
- 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 ...
- power shell upload file to azure storage
# Azure subscription-specific variables. $storageAccountName = "storage-account-name" $con ...
随机推荐
- [LintCode] Paint House 粉刷房子
There are a row of n houses, each house can be painted with one of the three colors: red, blue or gr ...
- call与apply基础用法告诉你
Js用法中还有个极好的但是有些抽象的用法——call与apply,今天我要简单总结一下: var ob1={ //对象ob1 name:"ob1", func1:function( ...
- oauth2.0了解
http://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html
- Devexpress TreeList控件绑定显示父子节点对像
今天一位同事咨询Devexpress TreeList控件绑定自动显示父子节点对像,但结果是不会显示带父子节点关系,而是将所有的节点作为父节点显示出来了,对像类的代码如下 public class I ...
- JavaAnnotation和反射简化开发
Part I 我并不是在卖弄自己的英语有多少的了不起,只不过对Annotation这一次的解释真的很懊恼,“注解”和“注释”这两个对Annotation的翻译我听着不爽,所以全文都用Annotatio ...
- redis与memcache的区别2
总结一: memcache官方定义 Free & open source, high-performance, distributed memory object caching system ...
- Leetcode | Find Minimum in Rotated Sorted Array I && II
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 migh ...
- 使用LVM对硬盘在线扩容
初始状态: root@control:/dev/nova-volumes# vgdisplay --- Volume group --- VG Name nova-volumes System ID ...
- php读取文件里面的数组做为配置文件
可能大家也都见过很多开源的产品,大多它们的配置文件都存放在一个单独的文件中,而这个文件里只存放了一个数组,其实这里运用了一个PHP的小技巧,就是可以将文件包含进来,并且赋值给一个变量,这个变量就具有了 ...
- Javascript中的new
直接上代码 function test () { } document.write(typeof test() + "<br />") document.write(t ...