//Excel上传
protected void btnExcel_Click(objectsender, EventArgs e)
{string backStr= UploadFile(FileUpload1, "Excel",1);if (backStr == "-1")
{//这里是放返回消息的,改为对应放消息的方式就行了,Js这个类就不上传了
//如Response.Write("");
Js.ShowSureMsgBox(this.Page,"请选择要提交的Excel文件");return;
}else if (backStr == "-2")
{
Js.ShowSureMsgBox(this.Page, "请选择.xls或.xlsx类型文件");return;
}else{string url = backStr; //绝对路径
DataTable dt =ExcelToDataSet(url);if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
//读取每行数据string phoneNum= dt.Rows[i][0].ToString(); }}else{
Js.ShowSureMsgBox(this.Page, "文件内容为空");
}
File.Delete(url);//删除上传的文件
}
}//记事本上传
protected void