Get the just uploaded file attachements in a WQS agent

Hello,

Is there a way to get the just uploaded file attachements in a WebQuerySave agent?

For example, I edit an existing document that already contains two attachments. I then upload two more attachments and hit save.

I use this to loop thru attachments:

	fileList = Evaluate("@AttachmentNames", docContext)

	Forall fileName In fileList 'loop thru all attachments

		fileType = Lcase(Strrightback(Cstr(fileName), "."))

		If (fileType = "jpeg" Or fileType = "jpg" Or fileType="gif") Then

			'Only JPEG and GIF are supported

			Set notesEmbeddedObject = docContext.GetAttachment(fileName)

		End If

	End Forall

It works fine… however, I’d like to loop thru the files that were just uploaded (new files) and not thru the existing files.

Is that possible?

Thanks!

Subject: Get the just uploaded file attachements in a WQS agent

Are you using upload controls to allow the user to post the attachments? If so, you can write a Javascript function that looks at the attachment name using this.form.UpoadControl.value. Then parse out the extension and validate for jpg or jpeg. I do this to prevent the user from posting files of type .exe. I know that if they have JS disabled, then it won’t work, but this is not a problem in my environment.

I got the function from here: http://javascript.internet.com/forms/upload-filter.html

Then just pass in the value of your form and the uploadControl.value that I mentioned before.

Subject: Here’s a smaller validation function that does something similar

Subject: RE: Here’s a smaller validation function that does something similar

Thank you all for your help on this.I’m gonna use parts of all your proposed solutions.

Subject: Store old filenames in another field

How about adding a field to your form that contains the names of the saved files. Read this field’s contents when you run the WQS agent and compare its list with that in @Attachment Names. Update this field via the agent AFTER you do your loop.