How to filter upload File


I'm using File in nuxeo studio to upload file.

How to can I upload only the .doc or .pdf file when I upload a file ?

I would like upload only the .doc or pdf file.

Thanks a lot.

0 votes

2 answers



Create a new widget type “mywidget” . Define

<property name="template">/widgets/mywidget_widget_template.xhtml</property> in the widget type.

Restrict the extensions that you want in mywidget_widget_template.xhtml file

  <c:set var="acceptedExtensions"
    value="#{nxu:test(!empty widgetProperty_acceptedExtensions, widgetProperty_acceptedExtensions, '.jpg, .jpeg, .png, .gif, .tif, .tiff, .psd, .raw, .ai, .svg, .ps, .eps, .epsi, .epsf, .xcf, .bmp')}" />

  <nxu:inputFile id="#{}" value="#{field}"
    filename="#{field.filename}" required="#{widgetProperty_required}" editFilename="false"
    onclick="#{widgetProperty_onclick}" onchange="#{widgetProperty_onchange}">

That's all. Hope this helps :) Happy Development ;)

1 votes

You can create your own custom widget based on extended_file_widget.

In the create/edit part of the widget, at the bottom, you can add a validateFileMimetype mark to limit which formats can be uploaded. This last page gives you an example at the top.

0 votes