cancel
Showing results for 
Search instead for 
Did you mean: 

Can someone PLEASE provide just ONE example of an upload

dallinns
Champ on-the-rise
Champ on-the-rise
I am ripping my hair out trying to get the upload webscript (alfresco/service/api/upload) to work. It seems simple enough but I can't get it to work for the life of me.

First of all, which parameters are necessary for NEW FILE UPLOAD (i.e. How can I possibly provide an updatenoderef if I'm not updating a node?). I don't want to update a node, all i want is to take one simple file off of my hard drive, and upload it to Alfresco into the company home folder. It asks for uploaddirectory and containerid. In what format does it want these? Do I provide the UUID of Company Home? Something else? How do I provide an uploaddirectory?

I'm sure this is all quite simple, but I just need a fully fleshed out example of an HTML form or a curl request which shows what is needed and in what format, etc.
13 REPLIES 13

zizou
Champ in-the-making
Champ in-the-making
thank you dnallsopp
you have give the easiest methode of uploading file in alf

this is how we do it in php for those who interest

<?php

$lien = 'http://userSmiley Tongueassword@localhost:8080/alfresco/service/api/upload';



//filedata=@myUpload.doc -F siteid=mysite -F containerid=documentLibrary -F uploaddirectory=/uploads

$fichier = 'fichier_a_uploader.txt';
$postfields = array(
   
   'filedata'  =>'@' . realpath($fichier),
   'siteid' => 'mysite',
   'containerid' =>'documentLibrary',
   'uploaddirectory' =>'/UTILITAIRE'
   
   
);

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, $lien);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);

$return = curl_exec($curl);
curl_close($curl);

if (!preg_match('#Username and password do not match#i', $return))
{
   echo 'Connexion ok. '.$return;
}
else
{
   echo 'Connexion échoué. '.$return;
}



farqalit_nasir
Champ in-the-making
Champ in-the-making

Thanks for your example but I got Error message 'Required parameters are missing'
when i tried your example.
Please Help! I have already spent lots of my time on it

Connexion ok. { "status" : { "code" : 400, "name" : "Bad Request", "description" : "Request sent by the client was syntactically incorrect." }, "message" : "Required parameters are missing", "exception" : "", "callstack" : [ ], "server" : "Community v5.2.0 (re21f2be5-b22) schema 10,057", "time" : "Nov 2, 2017 2:31:16 PM" }

devi
Champ in-the-making
Champ in-the-making
Can any body give example how to get content from Alfresco using UUID?

romschn
Star Collaborator
Star Collaborator
Out-of-the-box web script example URL as follows - http://serverSmiley Tongueort/alfresco/s/api/node/workspace/SpacesStore/{nodeid}/content - should get the content for the given node. Change the server, port and nodeid in this URL as per your setup.

Hope this helps.