<?xml version="1.0" encoding="UTF-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core" rendered="false"> <xp:this.afterRenderResponse><![CDATA[#{javascript:var externalContext = facesContext.getExternalContext(); var writer = facesContext.getResponseWriter(); var response = externalContext.getResponse(); // set content type, header response.setContentType("text/plain"); response.setHeader("Cache-Control", "no-cache"); // get posted uploaded file var request:com.sun.faces.context.MyHttpServletRequestWrapper = externalContext.getRequest(); var map:java.util.Map = request.getParameterMap(); var fileData:com.ibm.xsp.http.UploadedFile = map.get("MY_FILE_NAME"); var tempFile:java.io.File = fileData.getServerFile(); var correctedFile = new java.io.File(tempFile.getParentFile().getAbsolutePath() + java.io.File.separator + fileData.getClientFileName()); var success = tempFile.renameTo(correctedFile); // Save uploaded image to the new document var doc:NotesDocument = database.createDocument(); doc.replaceItemValue("Form", "MY_FORM"); var rtFiles:NotesRichTextItem = doc.createRichTextItem("UploadedFile"); rtFiles.embedObject(lotus.domino.local.EmbeddedObject.EMBED_ATTACHMENT, "",correctedFile.getAbsolutePath(), null); correctedFile.renameTo(tempFile); doc.save(); // write HTML output writer.write("OK "+fileData.getClientFileName()); writer.endDocument(); }]]> </xp:this.afterRenderResponse> </xp:view>