The Hoju Saram

Tuesday, September 19, 2006

Domino Activex Inotes File Upload Control

Database can be downloaded here

A number of years ago I wrote some code in Domino that allowed me to use the Domino Activex Inotes File Upload control in my own applications. The trick was that I wrote a java servlet to handle the fileuploads as the active control expected a particluar response from the server.

A couple of days ago I stumbled across an old post I made on ( as it was called at the time ) about this. I thought I would dig-up and re-publish the code here.

The about document of this database contains the java code for a servlet that is required to handle the file uploads sent from the ActiveX control. The instructions for installation are in the about document of the database. The rest of the database is a sample web discussion which shows how to use the code and activex control. To use the system you will need to re-sign the lotuscript code (agents and script libraries) with an id that can run agents on your server.

Basically the setup is this.

a) You configure,compile and install the java servlet on your domino server.
b) When you attach files via the activex control and submit the form then servlet captures the files sent from the activex control and stores them in a temp directory on the server.
c) When the form that contains the activex control is posted back to the server it triggers an agent to run that picks up the files from the temp directory and attaches them to the notes document.

You need to make the following changes to get this to work in your environment.

1. In the Thread subform you need to change the value of the V_ServerName field to be the base URI of your domino server.

2. On the server you need to create a directory where the files uploader servlet can temporarily store the files before they are attached by the agent. This directory must be under the notes data directory for the server.

3. You need to adjust the AttachUploadstoDoc function in the UploadFunctions script library by adjusting the line

FilePath = "d:\lotus\notes\FileUploads\" + Doc.VUser(0) + "\"

To match the directory on the server you set up in step 2.

4. You need to create a servlet ( using a java compiler ) using the java files attached to the “about this database document” and install it on your server,

The java package I created in this code is com.SHIS.inotes but you can change this just make sure you adjust the file ( step 5 ) to match you package name.

Before you complile the servlet adjust the line in file

FileOutputStream f = new FileOutputStream(new File("FileUploads/" + UID + "/" + FileName));

to match the name of the of the directory you create in 2. In the java code the directory name ( "FileUploads" ) is relative to the notes data directory , so you do not need the full path here.

5. Once you have compiled the java code then you need to install the .jar file on your server, and add the lines in the file ( attached in the “about this database document” ) to your servers file making sure that the java package name matches the java package you created.

If you need help on with installing servlets and the servlet engine settings please see the Domino Designer Help "Running servlets in Domino".

6. Once the servlet is in place and the servlet engine on the server is running then you can try out the activex upload control by creating a new message in this discussion database and attempt to attach some files and submit the message.


  • - is a very dynamic, complex server that allows you to upload and download as many files as you can possibly imagine! With up to 2GB upload capacity that no other server allows, Dead-Yahoo is unquestionably the best on the net. Not only a high-capacity upload volume, but full-bandwith speed (download/upload) is one of the other great features that ranks Dead-Yahoo number one on the charts. Dead-Yahoo takes the world of sharing to the next level!

    By Anonymous Anonymous, at 10:24 am, November 08, 2006  

  • I would use your experience to resolve my problem: I want customize, for some users only, use of iNotes access; in details, for these users I want hide attachments.
    Have you any suggestion ?

    By Anonymous MirkoMK, at 11:31 pm, January 03, 2007  

  • Hello, i've got your link from the developerWorks-Forum...
    Do you have a suggestion to create a richtext field wich has the same look in firefox and ie? I want to create a database used by notes and browser like the domino web access mail form. But didn't found the solution of the rich text ...

    By Anonymous Anonymous, at 5:58 pm, June 28, 2007  

  • mirkomk, sorry must have missed your comment. I think the only way to hide the attachments is to remove them on the server. Maybe write an "on-delivery" agent for those mailboxes that removed the attachments. The inotes web access interface is completely unchangable, so there is no way to hide any of the controls.

    By Blogger Hoju Saram, at 9:08 am, June 29, 2007  

  • Anonymous, you didn't leave any info on how to contact you so I guess you are going to read this sometime. There are a couple of ways to do what you want but it all depends if you also want the rich text available in the notes client , or whether this is going to be a "web-only" solution. If it is "web-only" then you should be able to set the body field of the memo forms to "Store as html and mime" and then use a nice htmlEditor ( check out any javascript sites on the web there are lots of them ) to let the users update the html. As long as you get a nice cross-browser control then you shouldn't have any problems with IE and Firefox.

    The comments box is a bit short to explain to much more, But if you want more info contact me at ( remove the #s)

    By Blogger Hoju Saram, at 9:13 am, June 29, 2007  

  • Also this is a little bit of code that may help you populate your htmleditor with the body of existing messages.

    By Blogger Hoju Saram, at 9:18 am, June 29, 2007  

  • (I'm trying to get the File Upload Control to work. I believe I've done everything correctly, but when the servlet tries to load, I get the attached error. Have you seen this before and if so, what is the fix? Thanks.

    Java Servlet Manager initialized
    Addin: Agent error message: Error occurred while initializing Servlet (FileUpload)
    Addin: Agent error message:

    -----Servlet Information-----
    Servlet name: FileUpload
    Servlet class: com.SHIS.inotes.UHandler
    Servlet state: Error
    Configuration parameters: none
    Addin: Agent printing: java.lang.ClassFormatError: Bad major version number: Bad major version number")

    By Anonymous Anonymous, at 12:23 am, August 08, 2007  

  • This seems really interesting, but I found the following issues:

    getDataByteOutputStream() throws an error because of outOfBound (posFinal=-1)
    and once I fixed this I found that it has issues with binary files (Word, etc...) and even with accents.

    Did someone else find this ? Since I'm far from being a Java guru, I'm stuck and would appreciate some help on this.

    By Anonymous Anonymous, at 1:33 am, October 03, 2007  

  • Hi, i found your application to be the closest approach to what we need to make the Aurigma File UPloader works in Domino apps, can u help us do this? my email is, hope you receive this message, regards.

    By Blogger Luis, at 3:57 pm, December 10, 2008  

  • By Anonymous Anonymous, at 11:44 am, May 06, 2009  

  • By Blogger Adi, at 9:19 am, November 09, 2009  

  • Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.
    Oes Tsetnoc | Semangat Mengembalikan Jati Diri Bangsa

    By Blogger Adi, at 12:07 am, December 01, 2009  

  • Hi,
    I use your Activex inotes fuc. Its worked. I can attach files. But, when i download the attachment using the 'Save' icon, it always prompt me error;'Error: Unable to download file "abc.doc" from "". Please help.

    By Anonymous Anonymous, at 5:31 pm, January 28, 2010  

  • same to me, also could not download the file using the 'Save' icon. Error message: Error: Unable to download file...

    Please help

    By Anonymous Anonymous, at 8:53 am, October 30, 2010  

Post a Comment

Links to this post:

Create a Link

<< Home