0

While downloading from document library in liferay 6.2 ,I am getting some issues in chrome like all the files are saved without extension at the time of downloading. This issues happens for the combination of windows 8 + office 2013 and windows 7+office 2010

                              long fileEntryId = getResume.getFileEntryId();
                              FileEntry fileEntry = DLAppServiceUtil.getFileEntry(fileEntryId);
                              fileEntry = fileEntry.toEscapedModel();
                              long folderId = fileEntry.getFolderId();
                              String title = fileEntry.getTitle();
                              mimeType = fileEntry.getMimeType();
                              System.out.println("LULU JEET: "+fileEntry.getMimeType());

                              if (resourceRequest != null) {
                                     themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
                              }

                              String fileUrl = themeDisplay.getPortalURL()
                                            + themeDisplay.getPathContext() + "/documents/"
                                            + themeDisplay.getScopeGroupId() + "//" + folderId
                                            + "//"
                                            + HttpUtil.encodeURL(HtmlUtil.unescape(title));
                              jobArray.put(fileUrl);
                       }

                       jsonFeed.put("jobArray", jobArray);
                       resourceResponse.setContentType(mimeType);
                       resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=Resume-" + candidateName + ".docx");
                       resourceResponse.setCharacterEncoding("UTF-8");
                       resourceResponse.getWriter().write(jsonFeed.toString());
                 } catch (Exception e) {
                       e.printStackTrace();
                 }

So in this code i am using FileEntry for this operation.But for chrome it is not working.Somebody please help.

lucifer
  • 2,297
  • 18
  • 58
  • 100

0 Answers0