Skip to main content
12-Amethyst
November 2, 2023
Question

We want to add file from local system to the server as a secondary attachment to wtDocument type

  • November 2, 2023
  • 2 replies
  • 814 views

We have wrote a html code to upload file as follows:

 

 <h3>File Upload</h3>
<form action="UploadServlet" method="post" enctype="multipart/form-data">
         <input type="file" name="file">
         <button type="submit">Upload File</button>
</form>

 

Need code in UploadServlet.jsp to fetch the document and attach it to the secondary attachment of the current wtDocument.

 

Thanks!

 

 

2 replies

avillanueva
23-Emerald I
23-Emerald I
December 21, 2023

Curious what is wrong with the normal check out and edit interface to upload via attachments?

18-Opal
December 21, 2023

I’ve written lots of code to get content and to add content.

I take it “name” in your form it the full path to the file? If yes, and you have the document (which I guess is the the document you are running the jsp from) to add the file from a given path as an attachment to the document is no problem.

 

Does that accurately describe the big picture?

If yes, I’d second what Mr Villanueva wrote.

 

If no, how about describing your use case.