您的位置:首页 > 其它

整理一个文件上传类

2008-08-15 10:58 169 查看
Code

//web上传控件

protected void Button1_Click(object sender, EventArgs e)

{

FileUploader fup = new FileUploader();

fup.IsRename = false;

fup.ReWrite = false;

string str = fup.GetSavFileName(this.Page, FileUpload1);

if (!string.IsNullOrEmpty(fup.ErrorMessage))

{

Response.Write(fup.ErrorMessage);

}

else

{

Response.Write("文件" + str + "成功上传到"+fup.UploadPath+"目录下!");

}

}

//HTML上传控件

protected void Button2_Click(object sender, EventArgs e)

{

FileUploader fup = new FileUploader();

fup.IsRename = false;

fup.ReWrite = false;

fup.FileType = ".chm";

fup.

string str = fup.GetSavFileName(this.Page,File1);

if (!string.IsNullOrEmpty(fup.ErrorMessage))

{

Response.Write(fup.ErrorMessage);

}

else

{

Response.Write("文件" + str + "成功上传到" + fup.UploadPath + "目录下!");

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: