Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 14th, 2007, 09:13 AM
Registered User
 
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default file downloads

Hi All,

I uploaded a file as doc file and stored into the data base as a blob of mysql data base.

I am writing code for down loading a files. For this i am seting the response headers as follows...
response.setContentType("application/msword");
response.setHeader("Content-Disposition", "attachment; filename=\""
+ fileName + ".doc\"");
response.setHeader("cache-control", "no-cache");
response.setDateHeader("max-age", 0);
response.setHeader("cache-control", "no-cache");
response.setHeader("Transfer-Encoding", "deflate");
response.setHeader("Content-Encoding", "en-us");
response.setContentLength(pasteResume.length());
response.setHeader("Connection", "keep-alive");
response.setHeader("Expires", "0");
response.setHeader("Vary", "Accept-Language,Accept-Encoding,User-Agent");
response.setHeader("Pragma", "no-cache");
response.setHeader("Content-Type","MIME"); //"text/html;;charset=%s % charset"
request.setCharacterEncoding("UTF-8");
response.setHeader("Content-Language","lang");

PROBLEMS IS::

When ever i am clicking the download link to download this file ,It start opening, but before it opening the file a dialog bix appears as follows..in linux and windows also
properties
Charcter Set : Unicode (UTF-8)
Default Fonts : Nimbus Roman No9 L
Language : English(USA)
Paragraph Break : CR&LF CK LF

Now if i click OK it opens the file correctly . I want to set it as default , So that this dialog box should not apper.
If any one knows why this box is appearing please tell me soon.

Thanks & Regards
karunakr reddy . kona:)

 
Old March 26th, 2007, 01:29 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,
 You dont need to set all those headers,setContentType() and setHeader for cache control and content disposition are enough, try commenting other setHeader and other method calls.

Regards,
Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
downloads JimBloomfield BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 June 23rd, 2006 09:17 AM
File Downloads - Fix in Progress Teresa BOOK: Access 2003 VBA Programmer's Reference 0 June 7th, 2006 01:23 PM
Downloads alexisb BOOK: Expert One-on-One Access Application Development 7 January 1st, 2005 10:24 PM
C# Downloads Mike Smith Wrox Book Feedback 3 December 14th, 2003 04:26 PM
Corrupt downloads Zooker Beginning VB 6 0 July 24th, 2003 11:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.