Solved

How to ignore space ?

Posted on 2007-11-23
5
1,892 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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 …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

770 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