Solved

How to ignore space ?

Posted on 2007-11-23
5
1,886 Views
Last Modified: 2012-06-27
ServletOutputStream out = response.getOutputStream();
            response.setContentType("application/x-download");
            String rowid=(String)request.getParameter("id");
            String fileName=(String)request.getParameter("filename");
            response.setHeader("Content-Disposition", "attachment; filename=" + fileName); // fileName ="ABCD EFGH IJKL.xls"
            DownloadUtil dutil =new DownloadUtil();
            byte[] excelbyte=dutil.getFile(rowid);
            out.write(excelbyte);


            the downloaded file comes as ABCD without any extension.

            but if there were no spaces in the filename , the downloaded files comes with the filename as it was.

            so, how to ignore space in the filename ?
0
Comment
Question by:cofactor
  • 3
  • 2
5 Comments
 

Author Comment

by:cofactor
ID: 20338483
my filename will have spaces and i want them downloaded with the same name with spaces
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 150 total points
ID: 20338527
Try

response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
0
 

Author Closing Comment

by:cofactor
ID: 31410657
excellent grade
0
 

Author Comment

by:cofactor
ID: 20341862
excellent grade CHEJ.

that worked
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20342202
:-)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now