<?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 Creating file in the repository in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/creating-file-in-the-repository/m-p/257512#M210642</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am writing a java backed webscript to upload a file into the Alfresco repository, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My challenge is that the i dont understand how to create a directory in the repository for the file &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this is my code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;String&amp;nbsp; nodePath = "" + repository.getCompanyHome();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println("File name is " + filefield.getFilename());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;InputStream fileContent=filefield.getContent().getInputStream();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;File uploadedFile=&lt;/SPAN&gt;&lt;STRONG&gt;new File(nodePath + "/" + filefield.getFilename());&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FileWriter writer = new FileWriter(uploadedFile);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i keep getting an exception that the file i created is does not exist when i want to use it in the line&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FileWriter writer = new FileWriter(uploadedFile);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;which implies that the directory i specify for the file is invalid&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please i need help on this&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jul 2011 11:59:13 GMT</pubDate>
    <dc:creator>oluwasegzy</dc:creator>
    <dc:date>2011-07-19T11:59:13Z</dc:date>
    <item>
      <title>Creating file in the repository</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/creating-file-in-the-repository/m-p/257512#M210642</link>
      <description>I am writing a java backed webscript to upload a file into the Alfresco repository, My challenge is that the i dont understand how to create a directory in the repository for the file this is my codeString&amp;nbsp; nodePath = "" + repository.getCompanyHome();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println("File name is " +</description>
      <pubDate>Tue, 19 Jul 2011 11:59:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/creating-file-in-the-repository/m-p/257512#M210642</guid>
      <dc:creator>oluwasegzy</dc:creator>
      <dc:date>2011-07-19T11:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating file in the repository</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/creating-file-in-the-repository/m-p/257513#M210643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You shouldn't be attempting to create files directly in the content store.&amp;nbsp;&amp;nbsp;&amp;nbsp; Instead you should be using a contentWriter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So you create a node with nodeService or fileFolderService,&amp;nbsp; get a content writer and then write the cm:content property.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Something like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ChildAssociationRef childRef = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CONTAINS, localQName, ContentModel.CONTENT, contentProps);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ContentWriter writer = fileFolderService.getWriter(childRef.yyyy);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.setMimetype(file.getMimeType());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.setEncoding(file.getEncoding());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.putContent(xxx);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Actua&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2011 12:58:18 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/creating-file-in-the-repository/m-p/257513#M210643</guid>
      <dc:creator>mrogers</dc:creator>
      <dc:date>2011-07-19T12:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating file in the repository</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/creating-file-in-the-repository/m-p/257514#M210644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Pls I dont understand the scriptlet you have explain. Can you please send me a full sample code?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2011 12:01:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/creating-file-in-the-repository/m-p/257514#M210644</guid>
      <dc:creator>oluwasegzy</dc:creator>
      <dc:date>2011-07-20T12:01:06Z</dc:date>
    </item>
  </channel>
</rss>

