码迷,mamicode.com
首页 > Web开发 > 详细

上传文件后台代码

时间:2016-08-15 17:20:36      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using Common;
using BLL;
namespace CRM.UI
{
public partial class CustomerInformationUpload : System.Web.UI.Page
{

CrmClient crmClient = new CrmClient();
protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
string FullName = FileUpload1.PostedFile.FileName;//获取路径名
if (FullName == "")
{
this.lbl.Text = "请选择excel文件!";
return;

}
FileInfo fi = new FileInfo(FullName);
string name = DateTime.Now.ToString("yyyyMMddHHmmssffff")+"_"+ fi.Name;
string type = fi.Extension;
string SavePath = Server.MapPath("~\\Upload\\Client") + "\\" + name;
this.FileUpload1.PostedFile.SaveAs(SavePath);
string result=crmClient.ExcelToParse(SavePath);

上传文件后台代码

标签:

原文地址:http://www.cnblogs.com/zhang-wenbin/p/5773577.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!