John Glabb John Glabb - 1 year ago 88
Javascript Question

Is there a way to change fileupload control file name on submit

Here is my simple xPage:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="">
<xp:dominoDocument var="document1" formName="File Resource"></xp:dominoDocument>
<xp:fileUpload id="fileUpload1" value="#{document1.FieldAttachment}">

<xp:button value="Save" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete" immediate="false" save="true"></xp:eventHandler>

I want on Submit/Save that it saves fileselected in RichText field but with custom name. In other words whatever user selects to upload I want it be custom name as a file attachment in Notes Document. E.g. user uploads MyPicture.jpg then on Submit/Save it adds the file as an attachment to Notes document but with other name, e.g. Picture1.jpg

Answer Source

Yes, you can change attachment's name on submit. Use fileUpload's property filename


enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download