<?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: Upload file using webscript in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-using-webscript/m-p/229505#M182635</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot! It really helped, just as I was beginning to get too frustrated..&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Sep 2009 08:36:56 GMT</pubDate>
    <dc:creator>shai</dc:creator>
    <dc:date>2009-09-22T08:36:56Z</dc:date>
    <item>
      <title>Upload file using webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-using-webscript/m-p/229501#M182631</link>
      <description>Hello,I'm building a simple cm server, and I want my users to be able to upload content to a certain space (almost always the same one), and to be able to apply a tag to it (categorize the content). I tried to do it using the upload webscript provided in the webscripts samples (http://wiki.alfresco.</description>
      <pubDate>Mon, 21 Sep 2009 08:25:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/upload-file-using-webscript/m-p/229501#M182631</guid>
      <dc:creator>shai</dc:creator>
      <dc:date>2009-09-21T08:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file using webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-using-webscript/m-p/229502#M182632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can definitely do that in webscripts. Where are you getting stuck?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2009 07:45:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/upload-file-using-webscript/m-p/229502#M182632</guid>
      <dc:creator>schambon</dc:creator>
      <dc:date>2009-09-22T07:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file using webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-using-webscript/m-p/229503#M182633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't figure out how to create the new content in a specified space other than 'company home'…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Shai&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2009 07:50:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/upload-file-using-webscript/m-p/229503#M182633</guid>
      <dc:creator>shai</dc:creator>
      <dc:date>2009-09-22T07:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file using webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-using-webscript/m-p/229504#M182634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the space is always the same one, then just get its node reference (you can get that in the Explorer UI : more actions &amp;gt; view details, then copy the Alfresco Node Reference link), which should look like: workspace://SpacesStore/8469e812-6383-42f6-9d89-872810d0e547&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then in the script, at the bottom you see:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;nbsp; // create document in company home for uploaded file&lt;BR /&gt;&amp;nbsp; upload = companyhome.createFile("upload" + companyhome.children.length + "_" + filename) ;&lt;BR /&gt;&amp;nbsp; upload.properties.content.write(content);&lt;BR /&gt;&amp;nbsp; upload.properties.encoding = "UTF-8";&lt;BR /&gt;&amp;nbsp; upload.properties.title = title;&lt;BR /&gt;&amp;nbsp; upload.properties.description = description;&lt;BR /&gt;&amp;nbsp; upload.save()&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;you need to change this to something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;nbsp; var folder = search.findNode("workspace://SpacesStore/8469e812-6383-42f6-9d89-872810d0e547");&lt;BR /&gt;&amp;nbsp; // create document in folder for uploaded file&lt;BR /&gt;&amp;nbsp; upload = folder.createFile("upload" + folder.children.length + "_" + filename) ;&lt;BR /&gt;&amp;nbsp; upload.properties.content.write(content);&lt;BR /&gt;&amp;nbsp; upload.properties.encoding = "UTF-8";&lt;BR /&gt;&amp;nbsp; upload.properties.title = title;&lt;BR /&gt;&amp;nbsp; upload.properties.description = description;&lt;BR /&gt;&amp;nbsp; upload.save()&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Rather than using a hardwritten node ref, you can also use:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;var folder = companyhome.childByNamePath("Data Dictionary/Wherever/You/Need");&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;(note that this is less robust, if someone decides to rename your folder you're stuck).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As for the tagging, you can use the addTag method on ScriptNode; so in the script add in something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;upload.addTag("my_wonderful_new_tag");&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sylvain.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS you may be interested in reading the documentation: &lt;/SPAN&gt;&lt;A href="http://wiki.alfresco.com/wiki/JavaScript_API" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/JavaScript_API&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2009 08:03:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/upload-file-using-webscript/m-p/229504#M182634</guid>
      <dc:creator>schambon</dc:creator>
      <dc:date>2009-09-22T08:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file using webscript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-using-webscript/m-p/229505#M182635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot! It really helped, just as I was beginning to get too frustrated..&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2009 08:36:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/upload-file-using-webscript/m-p/229505#M182635</guid>
      <dc:creator>shai</dc:creator>
      <dc:date>2009-09-22T08:36:56Z</dc:date>
    </item>
  </channel>
</rss>

