$doc = new stdClass(); $docType = end(explode(".", $_FILES['uploadedfile']['name'])); $doc->legacy = array("id" => "", "type" => strtolower($docType)); $doc->type = $_POST['resType']; $doc->kind = 'Resource'; $doc->language = $_POST['Language']; $doc->description = $_POST['discription']; $doc->title = $_POST['title']; $doc->author = $_POST['author']; $doc->created = date('Y-m-d'); $responce = $ttel_resources->storeDoc($doc); print_r($responce); try { // add attached to document with specified id from response $fileName = $responce->id . '.' . end(explode(".", $_FILES['uploadedfile']['name'])); $ttel_resources->storeAttachment($ttel_resources->getDoc($responce->id), $_FILES['uploadedfile']['tmp_name'], custom_mime_content_type($_FILES['uploadedfile']['tmp_name']), $fileName); ///$resources->storeAttachment($resources->getDoc($responce->id),$_FILES['uploadedfile']['tmp_name'], mime_content_type($_FILES['uploadedfile']['tmp_name'])); } catch (Exception $e) { print "No Resource to uploaded<br>"; } $resDoc = $ttel_resources->getDoc($responce->id); $resDoc->legacy->id = $responce->id; $ttel_resources->storeDoc($resDoc); /// recordAction($_SESSION['name'],"Uploaded resources... res title : ".$_POST['RTitle']); echo '<script type="text/javascript">alert("Successfully Uploaded ' . $_POST['title'] . '");</script>'; die("<br><br><br><br>Successfully saved - " . $_POST['title'] . ""); } ?> <script src="../includes/ice/ice.js" type="text/javascript"></script> <script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>