i have this code but i can't upload file into enywhere.
can you give an example of jsonData array syntax?
i have the default installation of alfresco and i have achieved to create direcory.
i cant find the way to upload file.
thanks
<?php
//API Url
$url = '192.168.1.1:8080/alfresco/s/api/upload?alf_ticket=TICKET_e0113b837d77e99b3e0a33da110e12be52bded4e';
//Initiate cURL.
$ch = curl_init($url);
//The JSON data.
$jsonData = array(
"filedata"=> "test.txt",
"siteid"=> "siteName",
"containerid"=> "documentLibrary",
"description"=> "A shiny new node"
);
//Encode the array into JSON.
$jsonDataEncoded = json_encode($jsonData);
//Tell cURL that we want to send a POST request.
curl_setopt($ch, CURLOPT_POST, 1);
//Attach our encoded JSON string to the POST fields.
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
//Set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
//Execute the request
$result = curl_exec($ch);
?>