Alfresco:: How to add custom properties during file upload using REST api

[亡魂溺海] 提交于 2019-12-13 04:44:00

问题


While uploading a file, I am using the below API.

http://localhost:8080/alfresco/service/api/upload 

File is getting uploaded successfully in alfresco repository. Now my requirement is, If I want to add custom properties like custom1, custom2, custom3, custom4 etc Could you please give us a solution using browser API/AJAX call.

Below is my code

<form method="post" name="uploadForm" enctype='multipart/form-data' id="upload_form" action="http://localhost:8080/alfresco/service/api/upload">
   <input type="hidden" name="destination" id="destination" value="workspace://SpacesStore/3f132339-bac1-4e0c-be03-b2ec5dbea61b" />
   <input type="hidden" name="overwrite" id="overwrite" value="false" />   
   <br />
   <label>custom1:</label>
   <br />
   <input type="text" name="custom1" id="custom1" />
   <br />
   <label>custom2:</label>
   <br />
   <input type="text" name="custom2" id="custom2" />
   <br />
   <label>custom3:</label>
   <br />
   <input type="text" name="custom3" id="custom3" />
   <br />           
   <label>custom4:</label>
   <br />
   <input type="text" name="custom4" id="custom4" />
       <br />
       <br />
   <label>File:</label>
   <br />
   <input class="button" type="file" name="filedata" id="filedata" />
   <br />
   <input class="button" type="submit" name="submit" value="Upload" />
</form>

回答1:


Please read this tutorial on custom content properties so that you can understand how to define your properties in the content model.

Then you can use the Alfresco REST API, or preferably, the CMIS API to update the properties.



来源:https://stackoverflow.com/questions/24278216/alfresco-how-to-add-custom-properties-during-file-upload-using-rest-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!