To upload files from within FreeMarker templates, use the standard HTML form "file"
type attribute.
Firstly ensure the following:
1. Make sure you have a backend OFBiz Event or Service configured to accept the uploaded file.
2. Configure the
controller.xml
request-map to designate the backend Event or Service to call when theform
is submitted.
Files can be uploaded in forms by following these steps:
1. Within a new or existing FreeMarker file, create or modify an HTML
form
. Be sure to include theform
attributeenctype
as"multipart/form-data"
.2. Add an input type of
"file"
as shown here:<form action="<@ofbizUrl>myFileUpload</@ofbizUrl>" name="addContentForm" method="post" enctype="multipart/form-data"> <#-- Add the rest of the Form's elements --> <input type="file" name="uploadedFile" size="25" id="uploadedFile" /> </form>