06-24-2009 10:05 AM
500 - socket_connect() failed. Reason: () The requested address is not valid in its context.
try{
//get configuration paramaters
$params = &JComponentHelper::getParams( 'com_alfrescodropbox' );
$params->merge( &$row->params );
$repoURL = (string)$params->get( 'Server' );
$nodeID = (string)$params->get( 'Node');
//setup session
$repository = new Repository($repoURL);
$session = $repository->createSession($_SESSION["ticket"]);
$spacesStore = new SpacesStore($session);
//find target dropbox node
$currentNode = null;
$currentNode = $session->getNode($spacesStore,$nodeID);
/////////////////////////
//check for file with existing name
$children = $currentNode->children;
foreach($children as $key=>$value){
$broken = explode('/', $key);
$childNode = $session->getNode($spacesStore,$broken[3]);
$props = $childNode->properties;
if($props['{http://www.alfresco.org/model/content/1.0}name'] == $_FILES['uploadedfile']['name']){
$updateError = 'We\'re sorry but, we currently do not allow users to update or delete files. <br /> Please change the file\'s name or contact your Project Manager to remove older files';
$this->setRedirect($link, $updateError, 'error');
return;
}
}
//////////////////////////
//create child
$upload = $currentNode->createChild('cm_content', 'cm_contains', 'cm_'.$_FILES['uploadedfile']['name']);
//prep file metadata/conetnt
$pathFile = $_FILES['uploadedfile']['tmp_name'];
$content_data = new ContentData($upload, $property, $mimetype, $encoding);
$content_data->mimetype = $_FILES['uploadedfile']['type'];
$content_data->encoding = "UTF-8";
$content_data->writeContentFromFile($pathFile);
//prep upload packaege
$upload->cm_content = $content_data;
$upload->cm_name = $_FILES['uploadedfile']['name'];
$fileName = (string)$upload->cm_name;
//push data to alfresco
$session->save(true);
}
catch (Exception $e) {
JError::raiseError(500, $e->getMessage());
}
05-20-2010 03:52 AM
05-20-2010 06:59 AM
05-21-2010 12:58 AM
05-21-2010 02:55 AM
05-21-2010 07:23 AM
05-21-2010 08:26 AM
05-21-2010 09:39 AM
05-21-2010 11:26 AM
05-24-2010 06:00 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.