m benway
m benway

Reputation: 245

Xpages File Download collect and display extra information

I'm using file upload and download control. I understand how to use the provided display columns, but how would I go about collecting other info about each uploaded file and then displaying it (i.e. Display Name and Notes that the user would enter)?

<xp:fileUpload id="fileUpload1"
                                value="#{document1.files}" style="width:80%"
                                useUploadname="false">


                                <xp:eventHandler event="onchange"
                                    submit="true" refreshMode="complete"
                                    disableValidators="true">
                                </xp:eventHandler>
                            </xp:fileUpload>
                            <xp:br></xp:br>

                            <xp:fileDownload rows="30" id="FD1"
                                displayLastModified="false" value="#{document1.files}"
                                style="width:98%" hideWhen="true" displayType="false"
                                displayCreated="true" rules="all"
                                lastModifiedTitle="Last Modified">

                                <xp:this.allowDelete><![CDATA[${javascript:database.queryAccessRoles(session.getEffectiveUserName()).contains('[Admin]')}]]></xp:this.allowDelete>
                            </xp:fileDownload>

Upvotes: 0

Views: 295

Answers (1)

stwissel
stwissel

Reputation: 20384

If I understand your question correctly: you want to add additional information columns into the file download control that are derived from information stored or computed elsewhere, e.g. from a NotesItem (a field in the Notes document)?

In this case you need to construct your own output using a repeat control. You can render a table or a list - whatever you deem fit for display.

The “trick” is how to construct the URL for download - which is simply:

/yourdatabase.nsf/0/unid/AttachmentName?OpenAttachment

(typed off memory. You might need to double check syntax).

Word of caution: if you have lots of attachments, you might consider having separate documents for them and use a view - above URL works in views too. Saves you a versioning headache (in case multiple users can upload to the same document).

Let us know how it goes

Upvotes: 1

Related Questions