How to ignore space ?

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 ?
cofactorAsked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
Try

response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
0
 
cofactorAuthor Commented:
my filename will have spaces and i want them downloaded with the same name with spaces
0
 
cofactorAuthor Commented:
excellent grade
0
 
cofactorAuthor Commented:
excellent grade CHEJ.

that worked
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.