41573

File Upload in a Xpages Extension Library Dialog Box

Question:

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

Answer1:

I don't have code to give you YET... but in the day job we use PLUpload instead of the built in controls. You can out PLUload inside a standard XPages dialog box. It gets connected to an XAgent of which this snippet: <a href="http://openntf.org/XSnippets.nsf/snippet.xsp?id=custom-xpage-file-upload-handler" rel="nofollow">http://openntf.org/XSnippets.nsf/snippet.xsp?id=custom-xpage-file-upload-handler</a><br /> is probably what you're looking for. I'm currently using an SSJS version but will be looking to migrate to the Java one. I then have code to process the uploads and move them to another database and also resize jpg's and stuff. A full example will be presented at the MWLug (2014) user group meeting and will also come to NotesIn9 soon. I just don't have all the code samples ready yet. But PLUpload with that snippet should be a good start.

Answer2:

What's your Domino server version? If it's lower than 9.0.1 file uploads cannot be done via a partial refresh, so it's not possible. In 9.0.1 you can run file upload with partial refresh, so it might be feasible.

Answer3:

It's possible.

The following code will work on a 9.0.1 server. 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. 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>

Recommend

  • Unable to reference a view in another database from XPiNC
  • XPages - Client side code to set viewScope value?
  • How to go from one page to another page using javascript?
  • How do I get the parent NotesViewEntry from the NotesXSPViewEntry?
  • Using External jar causing Error
  • Is there a DTD for XPage source?
  • Build Automatically versus Build Manually
  • how to update a value in array scoped variable?
  • Amazon s3 – 403 Forbidden with Correct Bucket Policy
  • Is there any kind of jQuery.browser fallback?
  • OAuth2 flow for mobile app
  • Retaining data after updating application
  • NHibernate Validation Localization with S#arp Architecture
  • Pass value from viewmodel to script in zk
  • Why ng-show works with ng-repeat but ng-if doesn't? [duplicate]
  • Optimizing database types to compact database (SQLite)
  • How do I fake an specific browser client when using Java's Net library?
  • Bug in WPF DataGrid
  • Cross-Platform Protobuf Serialization
  • Deserializing XML into class C#
  • Redux, normalised entities and lodash merge
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • Do I've to free mysql result after storing it?
  • QuartzCore.framework for Mono Develop
  • Python - Map / Reduce - How do I read JSON specific field in using DISCO count words example
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • How to format a variable of double type
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • How to delete a row from a dynamic generate table using jquery?
  • How to include full .NET prerequisite for Wix Burn installer
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • coudnt use logback because of log4j
  • how does django model after text[] in postgresql [duplicate]
  • How to stop GridView from loading again when I press back button?
  • Turn off referential integrity in Derby? is it possible?
  • JaxB to read class hierarchy
  • costura.fody for a dll that references another dll
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize