excel数据批量导入
来源:互联网 发布:网络大哥砸苹果手机店 编辑:程序博客网 时间:2024/06/05 10:32
1. html
<form id="form_search" action="@Url.Action("UpLoadFile")" enctype="multipart/form-data" method="post">
<td>
上传文件:<input class="easyui-filebox" id="fileTxt" name="fileName" style=" width:200px" data-options="prompt:'Choose a file...'" />
<a id="UpLoadFile" class="easyui-linkbutton" style="" data-options="iconCls:'icon-fresh',width:70" onclick="upLoadFile()">
上传
</a>
</td>
<script>
$('#fileTxt').filebox({
buttonText: '选择文件',
buttonAlign: 'right'
})
</script>
2.javascript
//文件上传
function upLoadFile() {
$("#UpLoadFile").click(function () {
debugger;
var upfile = $("#fileTxt").filebox("getValue");
if (upfile.length <= 0) {
$.mapuni.tips("请选择要上传的文件");
return;
}
var ext = upfile.split('.');
//$("#searchForm_dg").submit()
$("#form_search").ajaxSubmit(function (message) {
alert(message);
window.location.reload();
});
});
}
3.后台
public string UpLoadFile()
{
HttpPostedFileBase file = Request.Files["fileName"];
string fileName = Path.GetFileName(file.FileName);
string fileExt = Path.GetExtension(fileName);
if (fileExt == ".xls" || fileExt == ".xlsx")
{
//string dir=excelPath
Directory.CreateDirectory(Path.GetDirectoryName(excelPath));
string fullDir = excelPath + fileName;
file.SaveAs(fullDir);
return "文件保存成功";
}
else
{
return "文件保存失败";
}
}
private string excelPath = ConfigurationManager.AppSettings["DailyPublicationFilePath"];//"D:\\Test\\";//上传到服务器的路径
4.配置文件 AppSettingConfig.xml
<!--上传excel存放路径-->
<add key="ExcelFilePath" value="D:\HeNan\" />
- excel批量导入数据
- excel数据批量导入
- excel批量导入数据
- excel批量导入数据
- excel批量导入数据
- excel批量导入数据
- excel数据批量导入
- 批量导入Excel中的数据
- Excel批量数据导入Oracle
- EXCEL批量导入数据MVC
- excel模板批量导入数据
- 用QueryTable向excel批量导入数据
- 用ADO向Excel批量导入数据
- 用ADO向Excel批量导入数据
- 实现Excel数据批量导入到Access
- 用ADO向Excel批量导入数据
- ASP批量导入EXCEL中数据入库
- excel数据批量导入到Mysql数据库
- 项目验收文档模板(三)
- 使用最新的spring-tools-suit3.8.3遇到启动问题
- OC 封装的概念
- UIButton的状态
- Leetcode 434. Number of Segments in a String 字符串的分段 解题报告
- excel数据批量导入
- 快速幂取模运算
- go判断两个字符串是否是是相互打乱的,也就是说它们有着相同的字符,但 是对应不同的顺序。
- 2016年终总结
- 错题
- 超分辨率重建中的图像金字塔——高斯金字塔和拉普拉斯金字塔
- Go指南练习之《图片》
- 求二维数组最大子数组的和
- 截取小数点