asp.net 下载文件如何使文件下载到指定的文件夹中
2 回答
噜噜哒
TA贡献1784条经验 获得超7个赞
用SaveFileDialog对象。
private void SaveButton_Click(object sender, EventArgs e) {
SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.InitialDirectory = @"C:\"; saveFileDialog1.Title = "Save text Files";
saveFileDialog1.CheckFileExists = true;
saveFileDialog1.CheckPathExists = true;
saveFileDialog1.DefaultExt = "txt";
saveFileDialog1.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
saveFileDialog1.FilterIndex = 2; saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{ textBox1.Text = saveFileDialog1.FileName; }
}
- 2 回答
- 0 关注
- 1205 浏览
添加回答
举报
0/150
提交
取消