cancel
Showing results for 
Search instead for 
Did you mean: 

How to filter upload File

arbenghanam_
Champ in-the-making
Champ in-the-making

Hi,

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.

2 REPLIES 2

Greg_Drayon
Star Contributor
Star Contributor

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.

Pradeep_Bhat
Star Contributor
Star Contributor

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="#{widget.id}" value="#{field}"
    filename="#{field.filename}" required="#{widgetProperty_required}" editFilename="false"
    onclick="#{widgetProperty_onclick}" onchange="#{widgetProperty_onchange}">
  </nxu:inputFile>

That's all. Hope this helps 🙂 Happy Development 😉

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.