Help! How to add attatchments to a rich text field when run on the web?

I have a rich text field in a database to run on the web. The rich text field displays once the form is run on the web . But I am not able to attatch anything ( not even MS word documents) into the field.For the same form in notes I was able to attatch attatchments by using the option File → Attatch. But i am not able to add attatchments once the form is run on the web. I tried dragging the attatchment to the field, copying the document from my folder and trying to paste… nothing is working. I also tried changing the rich text field to rich text lite field.It did’nt work…

Is there any way to attatch documents to the rich text feld in the web?

Subject: RE: Help!!! How to add attatchments to a rich text field when run on the web?

For the web, you need a special “file upload control” on the page to add attachments. See the Designer help document “Creating an embedded file upload control”.

Subject: Help!!! How to add attatchments to a rich text field when run on the web?

You need to add a File Upload Control. In the Designer Client, go to the area that you would like to put the attachment, click Create - Embedded Element - File Upload Control. This will add a gray button to your form that says File Upload. View it in the web browser to see how it works…Good Luck

Subject: RE: Help!!! How to add attatchments to a rich text field when run on the web?

A File Upload Control will add the file as an old V2 style attachment to the bottom of your form, not into a RTF. Just call this function in your WebQuerySave agent.

Function MoveAttachment(doc As notesDocument, Byval moveToFieldName As String) As Boolean

' Files attached via the Web with the File Upload Control are stored as old style "V2 Attachments".

' These files are displayed at the bottom of the Notes form rather than in a rich text field.

' This function moves V2 Attachments to a rich text field.



MoveAttachment = False



Dim session As New notesSession	

Dim tempDir As String

tempDir = session.GetEnvironmentString("Directory", True)



' Put a trailing slash at the end of the directory if it is needed.

If Instr(tempDir, "/") <> 0 And Right(tempDir, 1) <> "/" Then tempDir = tempDir & "/"

If Instr(tempDir, "\") <> 0 And Right(tempDir, 1) <> "\" Then tempDir = tempDir & "\"



' Walk the items and extract the V2 files to the file system.

Forall item In doc.Items

	

	If item.type = ATTACHMENT Then

		

		' Get the attachment.

		Dim attachedFile As NotesEmbeddedObject

		Set attachedFile = doc.GetAttachment(item.values(0))

		

		' Get the target RTF.

		Dim tempItem As NotesItem

		Set tempItem = doc.GetFirstItem(moveToFieldName)

		

		Dim rtItem As NotesRichTextItem

		If Not(tempItem.Type = RICHTEXT) Then

			Call doc.RemoveItem(moveToFieldName)

			Set rtitem = doc.CreateRichTextItem(moveToFieldName)

		Else

			Set rtitem = tempItem

		End If

		

		 ' Is the attachment already in the RTF?

		Dim object As NotesEmbeddedObject

		Set object = rtitem.GetEmbeddedObject(attachedFile.Name)

		If Not(object Is Nothing) Then

			Goto NextItem

		End If

		

		' Extract the attachment to the temp directory.			

		Dim filePath As String

		filePath = tempDir & attachedFile.Name

		Call attachedFile.ExtractFile(filePath)

		

		' Remove the attachment.

		Call attachedFile.Remove

		

		' Embed the extracted files into the rich text field then remove the temp file.

		Call rtItem.EmbedObject(1454, "", filePath)

		Kill filePath

		

		MoveAttachment = True

		

	End If

NextItem:

End Forall

End Function