Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

How to get Uploaded file?


How to get Uploaded file?

I have created a wizard using attachments tags.





I am able to display browser option on wizard.

How to get that file on form Processor?


Did you ever solve this problem? If so, could please share the code?

I figured it out, but it's a little bit tricky and I'm not sure if I did it the right way, but it works.

This method is not finished, it's just an example to add an uploaded file as a primary of a WTDocument. If already a primary exists it need to be deleted first. So it will only work for a WTDocument with no file attached.


public FormResult doOperation(NmCommandBean nmCommandBean, List<ObjectBean> list) throws WTException {
	FormResult formResult = new FormResult();
	ObjectIdentifier oidObject = nmCommandBean.getElementOid().getOidObject();
	WTDocument wtDocument = (WTDocument) PersistenceHelper.manager.refresh(oidObject);
	try {

		ContentHolder contentHolder = ContentHelper.service.getContents(wtDocument);

		for (ObjectBean bean : list) {
			log.debug("bean = \"{}\"", bean.getParameterMap());
			Map<String, String> text = bean.getText();
			String oid = null;
			String filename = null;
			String cachedContentDescriptorValue = null;
			for (Map.Entry<String, String> entry : text.entrySet()) {
				String key = entry.getKey();
				log.debug("key = \"{}\"", key);
				if (key.startsWith("PRIMARY_FILE") && key.endsWith("_cachedContentDescriptor")) {
					oid = key.replace("PRIMARY_FILE_", "").replace("_cachedContentDescriptor", "");
					log.debug("oid = \"{}\"", oid);
					cachedContentDescriptorValue = entry.getValue();
					log.debug("cachedContentDescriptorValue = \"{}\"", cachedContentDescriptorValue);
				} else if (key.startsWith("PRIMARY_FILE") && key.endsWith("_filePath" )) {
					filename = entry.getValue();
			if (filename != null && oid != null && cachedContentDescriptorValue != null) {
				ApplicationData applicationData = ApplicationData.newApplicationData((ContentHolder) null);
				CachedContentDescriptor cachedContentDescriptor = new CachedContentDescriptor(cachedContentDescriptorValue);

	} catch (PropertyVetoException e) {
		log.error("Error 155122:", e);

	return formResult;



Top Tags