Ejemplo n.º 1
0
     $pos = sizeof($Otags);
     foreach ($addTags as $tag) {
         $pos++;
         $newTag = $conn->prepare("INSERT INTO `fileupload`.`options` (`group_id`, `option`, `sort`) VALUES ('4', :tag, :pos)");
         $newTag->bindParam(':tag', $tag);
         $newTag->bindParam(':pos', $pos);
         $newTag->execute();
     }
 } else {
     $fileUpdate->setTags($file->getTags());
 }
 $fileUpdate->setType(issetOrBlank($_POST['file-type']));
 $fileUpdate->setUploadDate($file->getUploadDate());
 //see if active has changed
 //alias - see if it
 $fileUpdate->setActive(issetOrBlank($_POST['file-active']) == "" ? 0 : 1);
 if (!isset($_FILES["file-file"])) {
     //no new file
     $fileUpdate->setUploader($file->getUploader());
     $fileUpdate->setSize($file->getSize());
     $fileUpdate->setContentType($file->getContentType());
     $fileUpdate->setExtension($file->getExtension());
     $fileUpdate->setPath($file->getPath());
 } else {
     //$file->setUploader( ($_SESSION['username'] != "" ? $_SESSION['username'] : '******' ); //from session?
     //$file->setSize($_FILES["file-file"]['size']);
     //$file->setContentType( issetOrBlank($_FILES["file-file"]['type']) );
     //$file->setExtension( pathinfo($_FILES["file-file"]['name'], PATHINFO_EXTENSION) );
     //delete existing file
 }
 $fileAlias = issetOrBlank($_POST['file-alias']);
Ejemplo n.º 2
0
 $tags = $conn->query($query);
 $tags->execute();
 $tags = $tags->fetchAll(PDO::FETCH_COLUMN);
 $newTags = explode(",", $file->getTags());
 $addTags = array_diff($newTags, $tags);
 $pos = sizeof($tags);
 foreach ($addTags as $tag) {
     $pos++;
     $newTag = $conn->prepare("INSERT INTO `fileupload`.`options` (`group_id`, `option`, `sort`) VALUES ('4', :tag, :pos)");
     $newTag->bindParam(':tag', trim($tag));
     $newTag->bindParam(':pos', $pos);
     $newTag->execute();
 }
 $file->setType(issetOrBlank($_POST['file-type']));
 $file->setUploadDate(date('Y-m-d H:i:s'));
 $file->setActive(1);
 $file->setAliasID(0);
 //echo UPLOADS_DIR;
 $DATEPATH = date('Y') . DIRECTORY_SEPARATOR . date('m') . DIRECTORY_SEPARATOR;
 $uploadTo = $DATEPATH . $file->getCampus() . DIRECTORY_SEPARATOR . $file->getFaculty() . DIRECTORY_SEPARATOR . $file->getCategory() . DIRECTORY_SEPARATOR;
 $uploadTo = issetOrBlank($uploadTo);
 //$uploadTo = "";
 //echo $uploadTo;
 //Ensure that the directory path exists
 //echo UPLOADS_DIR;
 //exit;
 mkpath(UPLOADS_DIR . $uploadTo);
 //echo UPLOADS_DIR.$uploadTo;
 $uploaded = 0;
 if (!file_exists(UPLOADS_DIR . $uploadTo)) {
     //could not create directory