Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to get full path when upload file choose desktop file workflow?

Avatar

Avatar
Give Back
Level 1
naruk89179065
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
Validate 1
View profile

Avatar
Give Back
Level 1
naruk89179065
Level 1

Likes

0 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
Validate 1
View profile
naruk89179065
Level 1

23-12-2018

Hi Team,

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.

fakepath.PNG

fakepath1.PNG

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.setPath("C:\fakepath\testJcrcontent.txt");

        attachment.setDisposition(EmailAttachment.ATTACHMENT);

        attachment.setDescription("Any Description");

        attachment.setName("Any name you can set");

Thanks

Kotireddy

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile
Gaurav-Behl
MVP

24-12-2018

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);

attachment.setPath(file.getPath());

Answers (0)