Results 1 to 3 of 3
- 07-07-2012, 11:13 AM #1
Member
- Join Date
- Feb 2009
- Posts
- 25
- Rep Power
- 0
How to download a file from directrory
After clicking the hyperlink, a file from directory has to be downloaded.control has come to Controller while debugging but file is not downloading.How to write for this?
Java Code:File dir = new File(request.getRealPath("/")+"uploads/"+bugId); try { response.setContentType("APPLICATION/DOWNLOAD"); response.setHeader("Content-Disposition", "attachment"+"filename=\""+fileName+"\""); FileInputStream stream = new FileInputStream(dir+"/"+fileName); response.setContentLength(stream.available()); os = response.getOutputStream(); os.close(); response.flushBuffer(); }catch(Exception e) { e.printStackTrace(); }
- 07-08-2012, 08:56 PM #2
Re: How to download a file from directrory
Moved from Advanced Java
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 07-09-2012, 10:57 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Similar Threads
-
How to show or open a file download or file save dialog box
By java_bond in forum New To JavaReplies: 0Last Post: 03-05-2010, 04:21 AM -
Download file from URL?
By makpandian in forum NetworkingReplies: 0Last Post: 03-10-2009, 12:31 PM -
Download file from URL?
By makpandian in forum New To JavaReplies: 0Last Post: 03-10-2009, 12:30 PM -
File Download
By AnGuRuSO in forum New To JavaReplies: 9Last Post: 10-29-2008, 11:00 AM -
file download
By abhiN in forum New To JavaReplies: 0Last Post: 02-08-2008, 09:10 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks