As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
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.
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.
Create a new widget type "mywidget" . Define
<property name="template">/widgets/mywidget_widget_template.xhtml</property> in the widget type.
<property name="template">/widgets/mywidget_widget_template.xhtml</property>
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 😉