<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unable to Download document of Correct Mimetype in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/unable-to-download-document-of-correct-mimetype/m-p/89893#M26883</link>
    <description>&lt;P&gt;The result seems to be expected as you are not passing the extension in the name. "&lt;STRONG&gt;name&lt;/STRONG&gt;" input param &lt;STRONG&gt;maps to cm:name property. &lt;/STRONG&gt;When you pass the name param, it will simply apply the input name as is to &lt;STRONG&gt;cm:name&lt;/STRONG&gt; property.&lt;/P&gt;
&lt;P&gt;This is default unless you implement a custom behavior which listens to node creation event and guess the mimetype + extension and append the extension in the name via custom code.&lt;/P&gt;
&lt;P&gt;To verify the name property mapping, use the below url to get all the properties for the recently uploaded file based on its id (nodeRefId) returned in the upload response:&lt;/P&gt;
&lt;P&gt;e.g., id:&lt;SPAN style="font-family: inherit;"&gt;7cea002a-07f8-47d8-8db8-721fc0858ce3&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://127.0.0.1:8080/" target="_blank" rel="noopener nofollow noreferrer"&gt;http://127.0.0.1:8080/&lt;/A&gt;&lt;STRONG&gt;alfresco/service/api/metadata?nodeRef=&lt;/STRONG&gt;workspace://SpacesStore/&lt;STRONG&gt;7cea002a-07f8-47d8-8db8-721fc0858ce3&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;You will see the properties like:&lt;/U&gt;&lt;/P&gt;
&lt;PRE&gt;....&lt;BR /&gt;properties: {
.....
{http://www.alfresco.org/model/system/1.0}node-uuid: "7cea002a-07f8-47d8-8db8-721fc0858ce3",
&lt;STRONG&gt;{http://www.alfresco.org/model/content/1.0}name: "CMIS Tutorial",
&lt;/STRONG&gt;....
....
}&lt;BR /&gt;....&lt;/PRE&gt;
&lt;P&gt;So in short, solution to your problem is that-&amp;gt;&amp;nbsp;&lt;STRONG&gt;don't pass name parameter&lt;/STRONG&gt; and system will automatically recognize the name of the file at the time of upload and map it to cm:name property. The &lt;STRONG&gt;cm:name&lt;/STRONG&gt; will be same as the file name you are uploading. And since extension will be already present, download issue will go away.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;See examples here:&amp;nbsp;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.alfresco.com/6.1/concepts/dev-api-by-language-alf-rest-upload-file.html" target="_blank" rel="noopener nofollow noreferrer"&gt;https://docs.alfresco.com/6.1/concepts/dev-api-by-language-alf-rest-upload-file.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Oct 2020 22:56:38 GMT</pubDate>
    <dc:creator>abhinavmishra14</dc:creator>
    <dc:date>2020-10-07T22:56:38Z</dc:date>
    <item>
      <title>Unable to Download document of Correct Mimetype</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/unable-to-download-document-of-correct-mimetype/m-p/89891#M26881</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am facing issue in downloading document with correct mimetype.&lt;/P&gt;&lt;P&gt;Issue is when i create a file by uploading content of type .pdf with the API like this:-&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Creating a Document with API" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/870i559CFA6E2E3C397E/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Creating a Document with API&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;File is created without extension though it should take extension as .pdf&amp;nbsp; as its contents but it is created without extension like below:-&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CMIS1.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/871iC13658690998FFFB/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If i check from node browser it mimetype is application/pdf:-&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CMIS2.PNG" style="width: 973px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/874i52729C1A119ABE07/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;And when i tried to download it is shows of type of File is:- FILE instead of .pdf like below:-&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CMIS3.PNG" style="width: 675px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/873i1C4EB9C947F3BFA1/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;So my query is how to get document downloaded correctly as its content is uploaded in .pdf format. So download should be as similar as .pdf.&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Piyush&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 10:14:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/unable-to-download-document-of-correct-mimetype/m-p/89891#M26881</guid>
      <dc:creator>piyush48</dc:creator>
      <dc:date>2020-10-07T10:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Download document of Correct Mimetype</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/unable-to-download-document-of-correct-mimetype/m-p/89892#M26882</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/80057"&gt;@piyush48&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried setting the mimetype when uploading?&lt;/P&gt;

&lt;PRE&gt;    "content": {
      "mimeType": "string",
      "mimeTypeName": "string"
    },&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://api-explorer.alfresco.com/api-explorer/#!/nodes/updateNode" target="_blank" rel="nofollow noopener noreferrer"&gt;https://api-explorer.alfresco.com/api-explorer/#!/nodes/updateNode&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 13:37:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/unable-to-download-document-of-correct-mimetype/m-p/89892#M26882</guid>
      <dc:creator>EddieMay</dc:creator>
      <dc:date>2020-10-07T13:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Download document of Correct Mimetype</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/unable-to-download-document-of-correct-mimetype/m-p/89893#M26883</link>
      <description>&lt;P&gt;The result seems to be expected as you are not passing the extension in the name. "&lt;STRONG&gt;name&lt;/STRONG&gt;" input param &lt;STRONG&gt;maps to cm:name property. &lt;/STRONG&gt;When you pass the name param, it will simply apply the input name as is to &lt;STRONG&gt;cm:name&lt;/STRONG&gt; property.&lt;/P&gt;
&lt;P&gt;This is default unless you implement a custom behavior which listens to node creation event and guess the mimetype + extension and append the extension in the name via custom code.&lt;/P&gt;
&lt;P&gt;To verify the name property mapping, use the below url to get all the properties for the recently uploaded file based on its id (nodeRefId) returned in the upload response:&lt;/P&gt;
&lt;P&gt;e.g., id:&lt;SPAN style="font-family: inherit;"&gt;7cea002a-07f8-47d8-8db8-721fc0858ce3&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://127.0.0.1:8080/" target="_blank" rel="noopener nofollow noreferrer"&gt;http://127.0.0.1:8080/&lt;/A&gt;&lt;STRONG&gt;alfresco/service/api/metadata?nodeRef=&lt;/STRONG&gt;workspace://SpacesStore/&lt;STRONG&gt;7cea002a-07f8-47d8-8db8-721fc0858ce3&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;You will see the properties like:&lt;/U&gt;&lt;/P&gt;
&lt;PRE&gt;....&lt;BR /&gt;properties: {
.....
{http://www.alfresco.org/model/system/1.0}node-uuid: "7cea002a-07f8-47d8-8db8-721fc0858ce3",
&lt;STRONG&gt;{http://www.alfresco.org/model/content/1.0}name: "CMIS Tutorial",
&lt;/STRONG&gt;....
....
}&lt;BR /&gt;....&lt;/PRE&gt;
&lt;P&gt;So in short, solution to your problem is that-&amp;gt;&amp;nbsp;&lt;STRONG&gt;don't pass name parameter&lt;/STRONG&gt; and system will automatically recognize the name of the file at the time of upload and map it to cm:name property. The &lt;STRONG&gt;cm:name&lt;/STRONG&gt; will be same as the file name you are uploading. And since extension will be already present, download issue will go away.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;See examples here:&amp;nbsp;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.alfresco.com/6.1/concepts/dev-api-by-language-alf-rest-upload-file.html" target="_blank" rel="noopener nofollow noreferrer"&gt;https://docs.alfresco.com/6.1/concepts/dev-api-by-language-alf-rest-upload-file.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 22:56:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/unable-to-download-document-of-correct-mimetype/m-p/89893#M26883</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-10-07T22:56:38Z</dc:date>
    </item>
  </channel>
</rss>

