Tuesday, February 19, 2008

File Uploading And Downloading

//For file Uploading
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs("D:\\weppage\\upload\\" + FileUpload1.FileName);
ListBox1.Items.Add(FileUpload1.FileName);
}


//For File Downloading
// Response.ContentType = "html/txt";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + ListBox1.SelectedValue.ToString() + "");
Response.TransmitFile("E:\\"+ListBox1.SelectedValue.ToString());
Response.End();

No comments: