Skip to content

Instantly share code, notes, and snippets.

@anthonysbrown
Created February 20, 2019 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonysbrown/a1b9d4a809de78affa226b09336131c7 to your computer and use it in GitHub Desktop.
Save anthonysbrown/a1b9d4a809de78affa226b09336131c7 to your computer and use it in GitHub Desktop.
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