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 ...
随机推荐
- 移位运算符(JAVA)
java中有三种移位运算符 << : 左移运算符,num << 1,相当于num乘以2 >> : 右移运算符,num >&g ...
- hdu Remainder
这道题是道很明显的bfs题.因为对数论没什么研究 ,所以这道题目里的两个关键点并不知道,看了别人的题解才知道 . 1.为避免取模后出现负数,采用:x%y=(x%y+y)%y 2.全部采用对m*k取模后 ...
- c# winform进入窗口后在文本框里的默认焦点
c# winform 设置winform进入窗口后在文本框里的默认焦点 进入窗口后默认聚焦到某个文本框,两种方法: ①设置tabindex 把该文本框属性里的tabIndex设为0,焦点就默认在这 ...
- SQL语句判断是否为今天或昨天
方法一 select * from AAA where to_char(a,'yyyymmdd') = to_char(sysdate,'yyyymmdd'); select * from AAA w ...
- windows下安装redis以及测试
Window 下安装 下载地址:https://github.com/dmajkic/redis/downloads. 下载到的Redis支持32bit和64bit.根据自己实际情况选择,将64bit ...
- php session_start() 非常慢 问题原因查找
最近在做东西的时候发现一个问题 有一个接口挂了 ,然后进行测试访问地址的时候,浏览器就一直处于等待响应的状态 怎么访问都不行,只有重启web服务器才行. 如果不重启web服务器进行代码调试,总发现在s ...
- C# Dictionary已知value获取对应的key
1:循环遍历法,分为遍历key-value键值对和遍历所有key两种形式 2:使用Linq查询法 private void GetDictKeyByValue() { Dictionary<in ...
- OpenGL问题拾遗
1 OpenGL设置好纹理以后显示不出来,显示为黑色 纹理默认会使用 mipmap .如果没有修改filter选项,或没有指定其他level的mipmap数据,就会显示不出来
- 【转】关于Unity协同程序(Coroutine)的全面解析
http://www.unity.5helpyou.com/2658.html 本篇文章我们学习下unity3d中协程Coroutine的的原理及使用 1.什么是协调程序 unity协程是一个能暂停执 ...
- ant build utf-8
使用Ant编译过程中,报error: unmappable character for encoding UTF8 最简单的方法是在Build.xml文件中,在所有出现Javac的地方,增加一个选项: ...