Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

File Download

Thread view: 
Krish - 08 Nov 2006 16:48 GMT
I am new to JSP and here stuck with a problem.....need help

Can anyone tell me how can i provide a download option in JSP for users
for a file which can be in any directories.......

please help
Simon Brooke - 08 Nov 2006 18:11 GMT
> I am new to JSP and here stuck with a problem.....need help
>
> Can anyone tell me how can i provide a download option in JSP for users
> for a file which can be in any directories.......

Just link to the file, as you would in HTTP. There's nothing special or
clever you need do.

Signature

simon@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/
       ;; Sending your money to someone just because they've erected
       ;; a barrier of obscurity and secrets around the tools you
       ;; need to use your data does not help the economy or spur
       ;; innovation. - Waffle Iron Slashdot, June 16th, 2002

Oliver Wong - 08 Nov 2006 22:57 GMT
>> I am new to JSP and here stuck with a problem.....need help
>>
[quoted text clipped - 3 lines]
> Just link to the file, as you would in HTTP. There's nothing special or
> clever you need do.

   This will only work if the file is in a directory which is being served
by the webserver. E.g. if you want to provide download to a file like
"C:\myFile.zip", you'll probably instead need to provide a link to a page
whose sole task is to read arbitrary files on the file system, and remit
their contents, e.g. <a
href="./downloader.jsp?link=C:\myFile.zip">Download</a>. But then you'd
probably want to implement some security so that people couldn't use that
page to download, for example, a list of username and passwords from your
server.

   - Oliver
Krish - 09 Nov 2006 08:27 GMT
thanks for the solution......but what should I code in
downloader.jsp...
Thanks oncce again

> >> I am new to JSP and here stuck with a problem.....need help
> >>
[quoted text clipped - 15 lines]
>
>     - Oliver
Oliver Wong - 10 Nov 2006 14:45 GMT
> thanks for the solution......but what should I code in
> downloader.jsp...
> Thanks oncce again

   Sorry, I don't know. I'm more of a PHP guy than a JSP guy.

   - Oliver
Andrew Thompson - 11 Nov 2006 02:06 GMT
> thanks for the solution......but what should I code in
> downloader.jsp...

Java, primarily.

As an aside - this is not a 'code generating machine'.
If you don't know what to put in the JSP (after
getting broad directions from those experienced in
server security), you either need ot learn Java or
hire a Java programmer.

Andrew T.
Simon Brooke - 09 Nov 2006 13:10 GMT
>>> I am new to JSP and here stuck with a problem.....need help
>>>
[quoted text clipped - 10 lines]
> whose sole task is to read arbitrary files on the file system, and remit
> their contents,

Do NOT - not ever - do that. Your webserver has a lot of security built in
precisely to prevent attackers being able to read arbitrary files in your
file system. If potential attackers /can/ read arbitrary files in your
file system, you just lost control of your server.

If you want people to be able to download a file, move that file into the
webserver's document root. Do NOT try to work around that.

Signature

simon@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/

                                       ;; this is not a .sig



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.