<?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: How can I upload a file with php with metadata in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313733#M734</link>
    <description>&lt;P&gt;Thanks for the answer.
I explained it wrong, I can upload the file but I can't set some metadata.
For example:
I can set typical metada like creator etc, but I can't set metadata which containing a list or type which more fields.&lt;/P&gt;
&lt;P&gt;With this code I can set normal metadata and it works:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-perl"&gt;        $answer= $session-&amp;gt;newRequest("Document.SetProperty")
            -&amp;gt;set('input', 'doc:' . $ls_path)
            -&amp;gt;set('params', 'value', $array2['name'])
            -&amp;gt;set('params', 'xpath', 'dc:title')
            -&amp;gt;sendRequest();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I don't know how can I insert a metadata which contains other fields of metadata like xml I put at first post.
I can't do screenshot now, but for example If I have a file that represents a book in nuxeo, and this book has many authors, I have a complexType called author with his fields like name, gender etc.
How I can set this fields?&lt;/P&gt;</description>
    <pubDate>Thu, 17 Nov 2016 12:27:03 GMT</pubDate>
    <dc:creator>Domingo_Gonzále</dc:creator>
    <dc:date>2016-11-17T12:27:03Z</dc:date>
    <item>
      <title>How can I upload a file with php with metadata</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313731#M732</link>
      <description>&lt;P&gt;Hi, I have a problem, I can upload a file with normal metadata, but I have a subtype of metadata like this:&lt;/P&gt;
&lt;P&gt;&amp;lt;xs:complexType name="blobList"&amp;gt;
&amp;lt;xs:sequence&amp;gt;
&amp;lt;xs:element name="item" type="nxs:content" minOccurs="0" maxOccurs="unbounded"/&amp;gt;
&amp;lt;/xs:sequence&amp;gt;
&amp;lt;/xs:complexType&amp;gt;&lt;BR /&gt; /&amp;gt;
&amp;lt;xs:element name="field1" type="xs:string"/&amp;gt;
&amp;lt;xs:element name="field2" type="xs:date"/&amp;gt;
&amp;lt;xs:element name="example1" type="nxs:exampleListType"/&amp;gt;
&amp;lt;xs:complexType name="exampleListType"&amp;gt;
&amp;lt;xs:sequence&amp;gt;
&amp;lt;xs:element name="item" type="nxs:exampleListType" minOccurs="0" maxOccurs="unbounded"/&amp;gt;
&amp;lt;/xs:sequence&amp;gt;
&amp;lt;/xs:complexType&amp;gt;
&amp;lt;xs:complexType name="nxs:exampleListType"&amp;gt;
&amp;lt;xs:sequence&amp;gt;
&amp;lt;xs:element name="field_01" type="xs:string"/&amp;gt;
&amp;lt;xs:element name="field_02" type="xs:string"/&amp;gt;
&amp;lt;xs:element name="field_03" type="xs:string"/&amp;gt;
&amp;lt;xs:element name="field_04" type="xs:string"/&amp;gt;
&amp;lt;xs:element name="field_05" type="xs:string"/&amp;gt;
&amp;lt;/xs:sequence&amp;gt;
&amp;lt;/xs:complexType&amp;gt;&lt;/P&gt;
&lt;P&gt;and I trying to upload a file adding metadata like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;        $answer= $session-&amp;gt;newRequest("Document.Create")
            -&amp;gt;set('input', 'doc:' . $array1['PATH'])
            -&amp;gt;set('params', 'type', 'example_doc')
            -&amp;gt;set('params', 'name', $array2['name'])
            -&amp;gt;sendRequest();
           
        $ls_path = $answer-&amp;gt;getDocument(0)-&amp;gt;getPath();
        $ls_UID = $answer-&amp;gt;getDocument(0)-&amp;gt;getUid();
        
        $answer= $session-&amp;gt;newRequest("Document.SetProperty")
            -&amp;gt;set('input', 'doc:' . $ls_path)
            -&amp;gt;set('params', 'value', $array2['name'])
            -&amp;gt;set('params', 'xpath', 'dc:title')
            -&amp;gt;sendRequest();
            
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;how can I do for upload a file to nuxeo with subtype and his properties?
thanks&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2016 16:39:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313731#M732</guid>
      <dc:creator>Domingo_Gonzále</dc:creator>
      <dc:date>2016-11-16T16:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I upload a file with php with metadata</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313732#M733</link>
      <description>&lt;P&gt;You should try the "Blob.Attach" operation.
For instance like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;$answer= $session-&amp;gt;newRequest("Document.Create")
            -&amp;gt;set('input', 'doc:' . $array1['PATH'])
            -&amp;gt;set('params', 'type', 'example_doc')
            -&amp;gt;set('params', 'name', $array2['name'])
            -&amp;gt;sendRequest();

$ls_path = $answer-&amp;gt;getDocument(0)-&amp;gt;getPath();
$ls_UID = $answer-&amp;gt;getDocument(0)-&amp;gt;getUid();
$ls_doc = $answer-&amp;gt;getDocument(0);

$answer= $session-&amp;gt;newRequest("Document.SetProperty")
            -&amp;gt;set('input', 'doc:' . $ls_path)
            -&amp;gt;set('params', 'value', $array2['name'])
            -&amp;gt;set('params', 'xpath', 'dc:title')
            -&amp;gt;sendRequest();

//We upload the file
$result = $session-&amp;gt;newRequest("Blob.Attach")
            -&amp;gt;set('params', 'document', $ls_doc-&amp;gt;getPath())
            -&amp;gt;loadBlob($FilePath, $FileMimotype)
            -&amp;gt;sendRequest();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;where:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;$array1['PATH'] - is a folder path in nuxeo&lt;/LI&gt;
&lt;LI&gt;$array2['name'] - is a name of file&lt;/LI&gt;
&lt;LI&gt;'example_doc' - should be 'file'&lt;/LI&gt;
&lt;LI&gt;$FilePath - is a full local path of file&lt;/LI&gt;
&lt;LI&gt;$FileMimotype - something like "application/pdf" or "application/msword"&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Wed, 16 Nov 2016 22:21:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313732#M733</guid>
      <dc:creator>adam_bo_</dc:creator>
      <dc:date>2016-11-16T22:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: How can I upload a file with php with metadata</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313733#M734</link>
      <description>&lt;P&gt;Thanks for the answer.
I explained it wrong, I can upload the file but I can't set some metadata.
For example:
I can set typical metada like creator etc, but I can't set metadata which containing a list or type which more fields.&lt;/P&gt;
&lt;P&gt;With this code I can set normal metadata and it works:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-perl"&gt;        $answer= $session-&amp;gt;newRequest("Document.SetProperty")
            -&amp;gt;set('input', 'doc:' . $ls_path)
            -&amp;gt;set('params', 'value', $array2['name'])
            -&amp;gt;set('params', 'xpath', 'dc:title')
            -&amp;gt;sendRequest();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I don't know how can I insert a metadata which contains other fields of metadata like xml I put at first post.
I can't do screenshot now, but for example If I have a file that represents a book in nuxeo, and this book has many authors, I have a complexType called author with his fields like name, gender etc.
How I can set this fields?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2016 12:27:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313733#M734</guid>
      <dc:creator>Domingo_Gonzále</dc:creator>
      <dc:date>2016-11-17T12:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I upload a file with php with metadata</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313734#M735</link>
      <description>&lt;P&gt;I answered up this post&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2016 12:27:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313734#M735</guid>
      <dc:creator>Domingo_Gonzále</dc:creator>
      <dc:date>2016-11-17T12:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I upload a file with php with metadata</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313735#M736</link>
      <description>&lt;P&gt;Have you try the 'AddEntryToMultivaluedProperty' operation:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;foreach ($array2 as $item)
{                        
    $answer= $session-&amp;gt;newRequest("AddEntryToMultivaluedProperty")
        -&amp;gt;set('input', 'doc:' . $ls_path)
        -&amp;gt;set('params', 'value', $item)
        -&amp;gt;set('params', 'xpath', 'Your:list_parameter')
        -&amp;gt;sendRequest();                        
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or the 'Document.AddItemToListProperty' operation?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2016 18:34:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313735#M736</guid>
      <dc:creator>adam_bo_</dc:creator>
      <dc:date>2016-11-17T18:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I upload a file with php with metadata</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313736#M737</link>
      <description>&lt;P&gt;Hi,
You should be able to create your document with metadata and then attach a file with the following code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-php"&gt;$answer = $session
  -&amp;gt;newRequest('Document.Create')
  -&amp;gt;set('input', 'doc:/default-domain/workspaces/Default Workspace')
  -&amp;gt;set('params', 'type', 'Article')
  -&amp;gt;set('params', 'name', 'doc01')
  -&amp;gt;set('params', 'properties', 'dc:title=doc01
  article:exampleList=[{"field01":"val001","field02":"val002","field03":"val003"}]')
  -&amp;gt;sendRequest();

$answer = $session
  -&amp;gt;newRequest('Blob.Attach')
  -&amp;gt;set('params', 'document', $answer-&amp;gt;getDocument(0)-&amp;gt;getPath())
  -&amp;gt;loadBlob('test.txt', 'text/plain')
  -&amp;gt;sendRequest();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Some references:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://explorer.nuxeo.com/nuxeo/site/distribution/Nuxeo%20DM-8.3/viewOperation/Document.Create" target="test_blank"&gt;http://explorer.nuxeo.com/nuxeo/site/distribution/Nuxeo%20DM-8.3/viewOperation/Document.Create&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://explorer.nuxeo.com/nuxeo/site/distribution/Nuxeo%20DM-8.3/viewOperation/Document.AddItemToListProperty" target="test_blank"&gt;http://explorer.nuxeo.com/nuxeo/site/distribution/Nuxeo%20DM-8.3/viewOperation/Document.AddItemToListProperty&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2016 22:03:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313736#M737</guid>
      <dc:creator>Pierre-Gildas_M</dc:creator>
      <dc:date>2016-11-17T22:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: How can I upload a file with php with metadata</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313737#M738</link>
      <description>&lt;P&gt;Its Works! Thank you so much!&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 11:45:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-can-i-upload-a-file-with-php-with-metadata/m-p/313737#M738</guid>
      <dc:creator>Domingo_Gonzále</dc:creator>
      <dc:date>2016-11-21T11:45:52Z</dc:date>
    </item>
  </channel>
</rss>

