Sign in to Community
Sign in to view all badges
I done customization for startworkflow.jsp("/libs/cq/gui/components/authoring/workflow/startworkflow/startworkflow.jsp").
When click upload file choose option getting fakepath append filename,How to get full path directory need to send email attachment.
I am not able send file attached by using fakepath. error message : java.io.FileNotFoundException: C:\fakepath\testJcrcontent.txt(The system cannot find the path specified).
EmailAttachment attachment = new EmailAttachment();
attachment.setName("Any name you can set");
Pick the file using File API like File file = new File(path_to_file); and then use file.getPath();
Alternatively, if you want to use a generic solution rather than a system dependent folder structure, try this -
File directory = new File("."); -- current WD for AEM, map the file path relative to AEM directory somewhere outside crx-quickstart
String path = directory.getCanonicalPath() + File.separator + LOCAL_FOLDER + File.separator; -- File.separator would work both on Win & Linux
File file = new File(path + filename);