how to download a file ??

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
 
C

Curt_C [MVP]

just point to it. The client should be prompted to save or open. It's a
client setting traditionally
 
C

Chris

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
 
C

Curt_C [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top