首页 > Web开发 > 详细

上传文件后台代码

时间:2016-08-15 17:19:44      阅读:282      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!