Hi Vineeth,
There is a very nice article for this exact issues:https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS18364
- Create a document:
WTDocument doc = WTDocument.newWTDocument(name, number, DocumentType.getDocumentTypeDefault());
- Create ApplicationData and upload a file to it.
ApplicationData theContent = ApplicationData.newApplicationData(doc);
String filename = "test.txt";
File theFile=new File("C:\\test.txt");
theContent.setFileName(filename);
theContent.setUploadedFromPath(path);
theContent.setRole(ContentRoleType.toContentRoleType("PRIMARY")); //if it’s secondary, use “SECONDARY”
theContent.setFileSize(theFile.length());
FileInputStream fis = new FileInputStream (theFile);
theContent = ContentServerHelper.service.updateContent(doc, theContent, fis);
ContentServerHelper.service.updateHolderFormat(doc);
doc = (WTDocument) PersistenceHelper.manager.refresh((Persistable)doc, true, true);
fis.close();
- Refer to Windchill Customizer's Guide (https://www.ptc.com/view?im_dbkey=117712), section The Upload Applet in Chapter E Additional Topics - Client Customization.
Hopefully this helps you with your implementation.
Thanks,
Jarrett