Add attach in a document from xe:dialog

Hi,

I have a problem in my web portal with a xe:dialog that generates a new document.

The document have several fields and the user can attach files in a Rich Text Field.

I use a File Upload Control to browser the file and from a “Save” button y add the file into the new document.

I don´t use a File Download control because this require a “FullRefresh”, and this hide my xe:dialog.

I use this code:

var doc:NotesDocument=document1.getDocument();
var file=getComponent(“fileUpload1”).getFilename()
doc.replaceItemValue(“Name_Field_RTF”,file);
doc.save();

But this generate an error, because the “file” var is null.

What I am doing wrong?

Best regards

Ana