Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CDM Upload File
<?php
#make the directory
$upload_dir = '' . SP_CDM_UPLOADS_DIR . '' . $uid . '/';
if (!is_dir(SP_CDM_UPLOADS_DIR)) {
mkdir(SP_CDM_UPLOADS_DIR, 0777);
}
if (!is_dir($dir)) {
mkdir($dir, 0777);
}
#run code to upload file
$filename = $_FILES['uploadedFile']['name'];
$upload = move_uploaded_file($_FILES['uploadedFile']['tmp_name'], $upload_dir. $filename);
#end run code to upload file
#insert file
$cdmPremiumUploader = new cdmPremiumUploader;
#build the file array
$file = array('uid'=>$uid,
'pid' =>$pid,
'cid'=>$cid,
'tags' => $tags,
'status' => 0,
'file'=>$filename,
'name'=>$filename,
);
#insert the file
$cdmPremiumUploader->finish($file, $uid);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment