<?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 Upload file programatically to Shared Files in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308870#M262000</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm running Alfresco one and need a java / curl solution to upload files from the local machine to the shared files doc area. &amp;nbsp;I can see there are other solutions out there that mention siteid (curl upload for example). &amp;nbsp;I have no sites configured nor do I want to use sites. &amp;nbsp;I just want to specify the folder the file to go into and have it uploaded there!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is much appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Sep 2016 20:58:13 GMT</pubDate>
    <dc:creator>taylorjackson</dc:creator>
    <dc:date>2016-09-22T20:58:13Z</dc:date>
    <item>
      <title>Upload file programatically to Shared Files</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308870#M262000</link>
      <description>Hey,I'm running Alfresco one and need a java / curl solution to upload files from the local machine to the shared files doc area. &amp;nbsp;I can see there are other solutions out there that mention siteid (curl upload for example). &amp;nbsp;I have no sites configured nor do I want to use sites. &amp;nbsp;I just want to spec</description>
      <pubDate>Thu, 22 Sep 2016 20:58:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308870#M262000</guid>
      <dc:creator>taylorjackson</dc:creator>
      <dc:date>2016-09-22T20:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file programatically to Shared Files</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308871#M262001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have different solutions for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bulk File System Import&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If your file system where are stored these files can be directly mounted&amp;nbsp;with the file system where the Alfresco repository is installed, you can consider to use the Bulk File System Import that is the official and supported tool by Alfresco for importing content into the repository:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://docs.alfresco.com/5.1/concepts/import-transfer.html" title="http://docs.alfresco.com/5.1/concepts/import-transfer.html" rel="nofollow noopener noreferrer"&gt;Importing and transferring files | Alfresco Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bash using cURL&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; font-weight: normal; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;$url ='&lt;A href="http://admin:passwd@WEBURL:8000/alfresco/service/api/upload" rel="nofollow noopener noreferrer" style="color: #1e88e5; border: 0px; font-weight: inherit; padding: 0px calc(12px + 0.35ex) 0px 0px;" target="_blank"&gt;http://admin:passwd@YourAlfrescoServer:8080/alfresco/service/api/upload&lt;/A&gt;'; &lt;BR /&gt;$filename = 'yourContent.pdf'; $mimetype = mime_content_type($filename); &lt;BR /&gt;$postfields = array( &lt;BR /&gt;&amp;nbsp; 'filedata' =&amp;gt; '@' . $filename,&lt;BR /&gt;&amp;nbsp; 'filename' =&amp;gt; $filename,&lt;BR /&gt;&amp;nbsp; 'siteid' =&amp;gt; 'yourSite',&lt;BR /&gt;&amp;nbsp; 'containerid' =&amp;gt; 'documentLibrary',&lt;BR /&gt;&amp;nbsp; 'uploaddirectory' =&amp;gt; 'test',&lt;BR /&gt;&amp;nbsp; 'contenttype' =&amp;gt; 'cm:content');&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Check the documentation of the upload service if you need a different behavior.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WebScripts with transaction none&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Another smart approach can be based on implement a WebScript with the transaction setting to none for importing each content in a gradual way. You can implement it using ECMAScript&amp;nbsp;or Java.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 06:33:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308871#M262001</guid>
      <dc:creator>openpj</dc:creator>
      <dc:date>2016-09-23T06:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file programatically to Shared Files</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308872#M262002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don't want to use &amp;nbsp;sites ,you can use Apache Chemistry OpenCMIS libraries,which is more easier to use than webscript api.&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 06:44:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308872#M262002</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2016-09-23T06:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file programatically to Shared Files</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308873#M262003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;CMIS ok, but if you have a massive import I suggest to use any other methods because CMIS typically is not the best API for solving this task. I would use CMIS only for progressive upload.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 06:52:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308873#M262003</guid>
      <dc:creator>openpj</dc:creator>
      <dc:date>2016-09-23T06:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file programatically to Shared Files</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308874#M262004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, i will look more into this. &amp;nbsp;do you know of any good tutorials?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 15:56:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308874#M262004</guid>
      <dc:creator>taylorjackson</dc:creator>
      <dc:date>2016-09-23T15:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file programatically to Shared Files</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308875#M262005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For alfresco cmis implementation document ,please refer to&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/docs/DOC-5527"&gt;CMIS&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;Following is&amp;nbsp;example snippet&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private Session getSession(String serverUrl, String username,&lt;BR /&gt; String password)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;SessionFactory sessionFactory = SessionFactoryImpl.newInstance();&lt;BR /&gt; Map&amp;lt;String, String&amp;gt; params = new HashMap&amp;lt;String, String&amp;gt;();&lt;BR /&gt; params.put(SessionParameter.USER, username);&lt;BR /&gt; params.put(SessionParameter.PASSWORD, password);&lt;BR /&gt; params.put(SessionParameter.ATOMPUB_URL, serverUrl);&lt;BR /&gt; params.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());&lt;BR /&gt; params.put(SessionParameter.OBJECT_FACTORY_CLASS,&lt;BR /&gt; "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");&lt;BR /&gt; List&amp;lt;Repository&amp;gt; repos = sessionFactory.getRepositories(params);&lt;BR /&gt; if (repos.isEmpty()) {&lt;BR /&gt; throw new RuntimeException("Server has no repositories!");&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;return repos.get(0).createSession();&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public void createDocument()&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;&lt;SPAN&gt; String serverUrl = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom" rel="nofollow noopener noreferrer" target="_blank"&gt;http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom&lt;/A&gt;&lt;SPAN&gt;";&lt;/SPAN&gt;&lt;BR /&gt; String userName = "admin";&lt;BR /&gt; String password = "admin";&lt;BR /&gt; Map&amp;lt;String, Object&amp;gt; properties = new HashMap&amp;lt;String, Object&amp;gt;();&lt;BR /&gt; properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,P:cm:titled");&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; properties.put(PropertyIds.NAME, "Platform__technical_documentation20140601");&lt;BR /&gt; properties.put(PropertyIds.CREATED_BY, "admin");&lt;BR /&gt; properties.put("cm:title", "Title x_technical_documentation20140601");&lt;BR /&gt; properties.put("cm:description", "Platform_technical_documentation20140601 15M");&lt;BR /&gt; Session session = getSession(serverUrl, userName, password);&lt;/P&gt;&lt;P&gt;try {&lt;BR /&gt; Folder folder1 = (Folder)session.getObjectByPath("/TESTFOLDER4");&lt;BR /&gt; VersioningState vs = VersioningState.MAJOR;&lt;BR /&gt; &lt;BR /&gt; File file = new File("C:\\userguide.pdf");&lt;BR /&gt; InputStream fis = new FileInputStream(file);&lt;BR /&gt; DataInputStream dis = new DataInputStream(fis);&lt;BR /&gt; byte[] bytes = new byte[(int) file.length()];&lt;BR /&gt; dis.readFully(bytes);&lt;BR /&gt; ContentStream contentStream = new ContentStreamImpl(file&lt;BR /&gt; .getAbsolutePath(), BigInteger.valueOf(bytes.length), "application/pdf",&lt;BR /&gt; new ByteArrayInputStream(bytes));&lt;BR /&gt; &lt;BR /&gt; Document newDocument = folder1&lt;BR /&gt; .createDocument(properties, contentStream, vs);&lt;BR /&gt; &lt;BR /&gt; System.out.println(newDocument.getId());&lt;/P&gt;&lt;P&gt;} catch (CmisContentAlreadyExistsException ccaee) { &lt;BR /&gt; System.out.println("ERROR: Unable to Load - CmisContentAlreadyExistsException: " );&lt;BR /&gt; } catch (CmisConstraintException cce) {&lt;BR /&gt; System.out.println("ERROR: Unable to Load - CmisConstraintException: " );&lt;BR /&gt; }catch (IOException e) {&lt;BR /&gt; // TODO Auto-generated catch block&lt;BR /&gt; e.printStackTrace();&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Sep 2016 02:36:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308875#M262005</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2016-09-24T02:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file programatically to Shared Files</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308876#M262006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi , can you tell me a complete examples of demo ?&amp;nbsp;&amp;nbsp; thank you .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Nov 2016 08:04:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/upload-file-programatically-to-shared-files/m-p/308876#M262006</guid>
      <dc:creator>luharry</dc:creator>
      <dc:date>2016-11-03T08:04:04Z</dc:date>
    </item>
  </channel>
</rss>

