Hello all,I am trying to write some php code to upload a file to my alfresco document library.Below is the code I am trying to use but alas it is not uploading anything. I am new to PHP and so have no concept as to what is wrong.The code below has been built from the tutorials and various other internet queries.I am getting quite lost would appreciate someone help me find my way ?Thanks in AdvanceConor M Hamill<?php
require_once "Alfresco/Service/Repository.php";
require_once "Alfresco/Service/Session.php";
require_once "Alfresco/Service/SpacesStore.php";
$repositoryUrl = "http://alfrescodev.xxxxxxx.xx.xx:8080/alfresco/api";
$userName = "admin";
$password = "xxxxxxxxx";
$parantID="2a113503-7ed5-4d8f-ad3f-9f96e20f054b";
$repository = new Repository($repositoryUrl);
$ticket = $repository->authenticate($userName, $password);
$mysession = $repository->createSession($ticket);
$store=new SpacesStore($mysession);
$node=$mysession->getNode($store,$parantID);
$upload=$node->createChild('cm_content','cm_contains',"$fname");
//$contentData=new ContentData($upload,"{http://www.alfresco.org/model/content/1.0}content");
$contentData=new ContentData($upload,'{http://http://www.alfresco.org/model/content/1.0}content');
?>
<html>
<head>
<title>Upload</title>
</head>
<body>
<?php
$fname = $_FILES['uploadFile']['name'];
if (isset($_POST["Submit"])) {
$fname=$_FILES['uploadFile']['name'];
$ftmp=$_FILES['uploadFile']['tmp_name'];
$ftype=$_FILES['uploadFile']['type'];
$fsize=$_FILES['uploadFile']['size'];
$contentData->encoding = 'UTF-8';
$contentData->writeContentFromFile($ftmp);
$contentData->size = $fsize;
$contentData->mimetype = $ftype;
$upload->cm_name = $fname;
$upload->cm_description = 'File Description';
$upload->cm_content = $contentData;
echo "ContentData = ".$contentData."<br>";
$mysession->save();
echo "done";
}
else { ?>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="uploadFile">
<input type="submit" value="Upload" name="Submit">
</form>
<?php } ?>
</body>
</html>