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

form with attachment

Avatar

Avatar
Validate 1
Level 3
AmbikaM
Level 3

Like

1 like

Total Posts

62 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 3
AmbikaM
Level 3

Like

1 like

Total Posts

62 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
AmbikaM
Level 3

11-03-2009

hi all,

im rendering a form through a process(invoking the process through a servlet)... the form will allow the user to attach files. on click of submit button, it calls a servlet. the servlet should check if the form contanins any attachments...if yes it should save the attachments in DB, but when ever i check for attachments in the servlet(console) it says "empty".



and whn i try saving the form in a the local drive and open it, it says not of proper format.now whr is the issue in the form or the way i check for attachments

Replies

Avatar

Avatar
Validate 1
Level 9
Steve_L_Walker
Level 9

Likes

197 likes

Total Posts

1,435 posts

Correct Reply

212 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
Level 9
Steve_L_Walker
Level 9

Likes

197 likes

Total Posts

1,435 posts

Correct Reply

212 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
Steve_L_Walker
Level 9

12-03-2009

Ambika,



Yesterday I put together a servlet to accomplish a similar task. The following code snippet gets the submitted PDF from the HTTP request input stream, calls Forms ES to render the PDF, gets the attachments from the rendered PDF, and iterates over the attachments. I added comments in the while loop, below, to indicate possible actions.



...

Document formIn = new Document(req.getInputStream());



RenderOptionsSpec renderOptionsSpec = new RenderOptionsSpec();

renderOptionsSpec.setLocale("en_US");



FormsResult formOut = formsServiceClient.processFormSubmission(formIn,

"CONTENT_TYPE=application/pdf",

"",

renderOptionsSpec);



List fileAttachments = formOut.getAttachments();

Iterator iter = fileAttachments.iterator();

int i = 0 ;



while (iter.hasNext()) {

Document fileAttachment = (Document)iter.next();

// do DB processing or validate the attachments using...

// File myFile = new File("C:\\attachment" + i + ".pdf");

// fileAttachment.copyToFile(myFile);

i++ ;

}

...



Steve

Avatar

Avatar
Validate 1
Level 3
AmbikaM
Level 3

Like

1 like

Total Posts

62 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 3
AmbikaM
Level 3

Like

1 like

Total Posts

62 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
AmbikaM
Level 3

12-03-2009

hi,

Avatar

Avatar
Validate 1
Level 3
AmbikaM
Level 3

Like

1 like

Total Posts

62 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 3
AmbikaM
Level 3

Like

1 like

Total Posts

62 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
AmbikaM
Level 3

12-03-2009

hi walker,



the same thing i did, still nothing seems to work.It always prints in the console as "attachments empty." please help me out in resolving this issue.