Hi Everyone !
I work with this alfresco version : All-In-One (AIO) project for SDK 4.0
I would like to upload a file with DocLibAction but in Java part, I receive this value : {pdf-document-upload=C:\fakepath\pom.xml}
add-doclib-actions-extension-modules.xml
========================================
<config evaluator="string-compare" condition="upload-pdf"> <forms> <form> <field-visibility> <show id="pdf-document-upload" /> </field-visibility> <appearance> <field id="pdf-document-upload" label-id="com.assystem.doclib.action.uploadPDF.form.field.pdf-document-upload"> <constraint-handlers> <constraint type="MANDATORY" validation-handler="Alfresco.forms.validation.mandatory" event="blur" /> </constraint-handlers> <control template="/com/assystem/form/controls/uploadpdf.ftl" /> </field> </appearance> </form> </forms> </config>
uploadpdf.ftl
=========================================
<div class="form-field"> <label>Upload PDF:</label> <input type="file" multiple="" name="prop_pdf-document-upload" /> </div>
UploadPDFExecuter.java
==========================================
public class UpdateLivrablePDFExecuter extends ActionExecuterAbstractBase { public static final String PARAM_PDF_DOCUMENT_UPLOAD = "pdf-document-upload"; private ServiceRegistry serviceRegistry; @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { // Result of uploadFile : {uploadFile=C:\fakepath\pom.xml} Serializable uploadFile = (Serializable) action.getParameterValue(PARAM_PDF_DOCUMENT_UPLOAD);
How can i have my document in uploadFile ? (instead of uploadFile=C:\fakepath\pom.xml)
Thank you for yours answers !
Solved! Go to Solution.
The Forms framework is not designed to handle file uploads at all - both on the client and the server-side. So there is no way to support this unless you use some custom dialog handling code on the client (which may still use the form definition to render the form UI) which calls a custom web script endpoint to accept the parameters, including the file upload, which also requires some custom submit handling code to properly transfer to that endpoint.
The Forms framework is not designed to handle file uploads at all - both on the client and the server-side. So there is no way to support this unless you use some custom dialog handling code on the client (which may still use the form definition to render the form UI) which calls a custom web script endpoint to accept the parameters, including the file upload, which also requires some custom submit handling code to properly transfer to that endpoint.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.