window.location = "downloadFile.jsp?" +
"p=" + encodeURIComponent(directoryPath) +
"&n=" + encodeURIComponent(fileName);
} // End doDownload().
As usual, we first verify that a directory and a file are in fact selected; otherwise, there??™s
nothing to do here, and we immediately exit the function.
Next, we get the contents of the third column in the file grid, which is the type of the
selected item. If it turns out that it??™s a directory, we pop up a message saying directories can??™t
be downloaded, and the function is exited.
After that, we get the path of the selected directory from the tree component. Then we get
the name of the selected file from the file grid. With that information, we can now get to the
downloadFile.jsp. To do this, we set the location of the window object to a URL we construct
that includes two parameters: p, which is the path, and n, which is the name of the file. You
may be wondering why the Fileman app itself doesn??™t get overwritten when we do this, and the
answer is that the downloadFile.jsp, as you may recall, sets the Content-Disposition header
to indicate the response is to be downloaded, so the browser won??™t overwrite what??™s there
already, and Fileman lives to, err, file, another day!
doUpload() Method
The doUpload() method is next, and it??™s a very quick and easy hit:
this.
Pages:
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559