简体   繁体   English

Xpages扩展库对话框中的文件上传

[英]File Upload in a Xpages Extension Library Dialog Box

Is there anyway to get the a File upload/download to work in a extension library dialog box? 无论如何,要使文件上传/下载在扩展库对话框中起作用吗? The file unload control seems to work but never stores the file in the document. 文件卸载控件似乎起作用,但是从不将文件存储在文档中。 The other controls(inputtext, computed and dates) in the dialog works correctly Thx 对话框中的其他控件(输入文本,计算和日期)可以正常工作

What's your Domino server version? 您的Domino服务器是什么版本? If it's lower than 9.0.1 file uploads cannot be done via a partial refresh, so it's not possible. 如果低于9.0.1,则无法通过部分刷新来完成文件上传,因此这是不可能的。 In 9.0.1 you can run file upload with partial refresh, so it might be feasible. 在9.0.1中,您可以使用部分刷新来运行文件上传,因此这是可行的。

I don't have code to give you YET... but in the day job we use PLUpload instead of the built in controls. 我没有代码可以给您...但是在日常工作中,我们使用PLUpload而不是内置控件。 You can out PLUload inside a standard XPages dialog box. 您可以在标准XPages对话框中输出PLUload。 It gets connected to an XAgent of which this snippet: http://openntf.org/XSnippets.nsf/snippet.xsp?id=custom-xpage-file-upload-handler 它连接到该代码段的XAgent: http ://openntf.org/XSnippets.nsf/snippet.xsp?id=custom-xpage-file-upload-handler
is probably what you're looking for. 可能正是您想要的。 I'm currently using an SSJS version but will be looking to migrate to the Java one. 我目前使用的是SSJS版本,但希望将其迁移到Java版本。 I then have code to process the uploads and move them to another database and also resize jpg's and stuff. 然后,我有代码来处理上载并将它们移动到另一个数据库,并调整jpg和其他内容的大小。 A full example will be presented at the MWLug (2014) user group meeting and will also come to NotesIn9 soon. 完整的示例将在MWLug(2014)用户组会议上进行介绍,并将很快出现在NotesIn9中。 I just don't have all the code samples ready yet. 我只是还没有准备好所有代码示例。 But PLUpload with that snippet should be a good start. 但是带有该代码段的PLUpload应该是一个好的开始。

It's possible. 这是可能的。

The following code will work on a 9.0.1 server. 以下代码将在9.0.1服务器上工作。 Not sure about pre-9.0.1 though: doing a partial refresh with a file upload is a feature that was introduced in 9.0.1. 但不确定9.0.1之前的版本:9.0.1中引入了一项功能,即使用文件上传进行部分刷新。 A tip: if you include validations in the dialog, a partial refresh of only the dialog won't work: you need to refresh an element that contains the dialog. 提示:如果您在对话框中包含验证,则仅刷新该对话框是无效的:您需要刷新包含该对话框的元素。

<xp:text
    escape="true"
    id="computedField1"
    value="#{javascript:@Now().getTime()}">
</xp:text>

<xp:button
    value="show dialog"
    id="button1">
    <xp:eventHandler
        event="onclick"
        submit="true"
        refreshMode="partial"
        refreshId="dialog1">
        <xp:this.action><![CDATA[#{javascript:getComponent("dialog1").show();}]]></xp:this.action>
    </xp:eventHandler>
</xp:button>

<xe:dialog
    id="dialog1"
    title="Look. I'm a dialog!">

    <xp:panel>
        <xp:this.data>
            <xp:dominoDocument
                var="document1"
                formName="fUpload">
            </xp:dominoDocument>
        </xp:this.data>
        <xe:dialogContent
            id="dialogContent1">

            Pick a file:

            <xp:fileUpload
                id="fileUpload1"
                value="#{document1.files}"></xp:fileUpload>

        </xe:dialogContent>

        <xe:dialogButtonBar
            id="dialogButtonBar1">

            <xp:button
                value="Save"
                id="button2">
                <xp:eventHandler
                    event="onclick"
                    submit="true"
                    refreshMode="partial"
                    refreshId="dialog1"
                    immediate="false"
                    save="true"></xp:eventHandler>
            </xp:button>

        </xe:dialogButtonBar>

    </xp:panel>
</xe:dialog>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM