• Upload / download file that are stored in a different database

    By Peter Strackx 1 decade ago

    I'm developing a web site that uses documents from different database.

    The tool now links the attachments to the current database and not to the database where the document resides.

    ex. Xpages document is in database A but the shows a document in the xpage is in database B.

    The upload control should use the parent database of the document passed in the parameters to the CC instead of the database that contains the xPage.

    I tried to figure out where everything is but its a long search :-)

    • Upload to another database

      By Mark Leusink 1 decade ago

      Hello Peter,

       

      I can give you some pointers on what needs to be changed to be able to upload files to another database:

      • Copy xpFileUploads and aUpload to the target database. Make aUpload available to public users.
      • In the target upload database: allow Read- and Write Public Documents access for Anonymous users. The user performing the upload should be able to create documents.
      • In the aGetAuthKey XPage there are 3 references to the current database ( database. ): change these to the target upload database, e.g.:

       

      var dbUpload = session.getDatabase("", "");

       

      • In the dominoFileUploads library, function getUploadURL, change the path to the target upload database:

       

      return "/" + "/" + this.xpageUpload +
                  "?authKey=" + this.authKey +
                  "&id=" + this.uploadToDocumentUNID +
                  (this.dataName != null ? "&dataName=" + this.dataName : "") +
                  (this.itemNameFiles != null ? "&item=" + this.itemNameFiles : "")


      Mark