// Create New instance of FileInfo class to get the properties of the file being downloaded
FileInfo file = new FileInfo(AppPath);
// Checking if file exists
if (file.Exists)
{
// Clear the content of the response
Response.ClearContent();
// LINE1: Add the file name and attachment, which will force the open/cance/save dialog to show, to the header
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
// Add the file size into the response header
Response.AddHeader("Content-Length", file.Length.ToString());
// Set the ContentType
Response.ContentType = ReturnExtension(file.Extension.ToLower());
// Write the file into the response (TransmitFile is for ASP.NET 2.0. In ASP.NET 1.1 you have to use WriteFile instead)
Response.TransmitFile(file.FullName);
// End the response
Response.End();
}
}
could you please provide the assistance for me to complete this task.
Member
12 Points
35 Posts
Download video file to mobile through data cable or bluetooth
Jul 07, 2008 07:04 AM|krishnakumari|LINK
Hi,
I am developing a web application in that one task is downloading the video file to the mobile or ipods.
when I was searching I got this code to download. but the problem is we have to restrict the user to download on system.
I should allow user to download to mobile directly through bluetooth or data cable.
protected void Button1_Click(object sender, EventArgs e)
{
string url1 = Session["sname"].ToString();
string AppPath = Request.PhysicalApplicationPath;
AppPath = AppPath + url1;
//string filepath = Server.MapPath(url1);
// Create New instance of FileInfo class to get the properties of the file being downloaded
FileInfo file = new FileInfo(AppPath);
// Checking if file exists
if (file.Exists)
{
// Clear the content of the response
Response.ClearContent();
// LINE1: Add the file name and attachment, which will force the open/cance/save dialog to show, to the header
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
// Add the file size into the response header
Response.AddHeader("Content-Length", file.Length.ToString());
// Set the ContentType
Response.ContentType = ReturnExtension(file.Extension.ToLower());
// Write the file into the response (TransmitFile is for ASP.NET 2.0. In ASP.NET 1.1 you have to use WriteFile instead)
Response.TransmitFile(file.FullName);
// End the response
Response.End();
}
}
could you please provide the assistance for me to complete this task.
provide me some help full link.
Thank you