how to download a file ??

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

Hi,

in a webpage do I build a treeview displaying the content of a directory and
its subdirectories.

1) Now, when I click on a filename that is listed in the treeview would I
like to
download that file.

how can I do this ?

2) building the treeview takes some time. Is there some way I can reuse the
collected data the next time I access the page ? using some kind of cache ?

thnx
Chris
 
just point to it. The client should be prompted to save or open. It's a
client setting traditionally
 
Hi Curt,

it doesn't happen , maybe since the treeview just contains string data ?

I fill it as follows :

DirectoryInfo d = new DirectoryInfo(path);

FileInfo[] f = d.GetFiles();
foreach (FileInfo fi in f)
{
TreeNode nodeFile = new TreeNode();
nodeFile.Text = fi.Name;
nodeFile. NodeData = fi.DirectoryName + @"\" + fi.Name;
TreeViewObj1.Nodes.Add(nodeFile);
}

so, is there anything else I have to do in order to trigger a download ?

thnx
Chris
 
create an <a href...> or "window.open()" for the onClick passing in the
filename

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


Chris said:
Hi Curt,

it doesn't happen , maybe since the treeview just contains string data ?

I fill it as follows :

DirectoryInfo d = new DirectoryInfo(path);

FileInfo[] f = d.GetFiles();
foreach (FileInfo fi in f)
{
TreeNode nodeFile = new TreeNode();
nodeFile.Text = fi.Name;
nodeFile. NodeData = fi.DirectoryName + @"\" + fi.Name;
TreeViewObj1.Nodes.Add(nodeFile);
}

so, is there anything else I have to do in order to trigger a download ?

thnx
Chris
Curt_C said:
just point to it. The client should be prompted to save or open. It's a
client setting traditionally

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


directory
and
would
I reuse
the cache
 
Back
Top