05-09-2013 10:00 AM
<?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>
05-16-2013 10:37 AM
05-28-2013 05:23 AM
08-08-2013 04:19 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.