File: D:/HostingSpaces/SBogers64/klimroosbudel.nl/wwwroot/kms/app/controllers/c_doc_page.class.php
<?php
/**
* c_home.class.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 3/19/13
*/
class Doc_Page extends Controller
{
public function __construct()
{
parent::__construct();
}
/*
* Gets the dashboard of our homepage
*/
public function index()
{
Url_Pin::set();
// Set title of this page
$this->View->setData('page_title', 'Actueel - '.SITE_NAME);
// Render the view
$this->View->render('v_actueel');
}
public function validate()
{
$valid = false;
if (! empty($_FILES['docs'])) {
// Create file array
$file = ['name'=> 'klimroos-actueel.pdf',
'tmp_name'=>$_FILES['docs']['tmp_name'],
'size'=>$_FILES['docs']['size'], ];
$FileUploader = new File_Uploader($file);
$FileUploader->set('_allowedExt', ['pdf']);
$FileUploader->set('_uploadTarget', $_SERVER['DOCUMENT_ROOT'].'/docs/');
if ($FileUploader->validate()) {
if ($original = $FileUploader->upload()) {
$valid = true;
}
}
}
if ($valid) {
$this->Alert->set('Uw PDF is succesvol gewijzigd', 'success');
} else {
$this->Alert->set(['Er is helaas iets misgegaan, probeert u het opnieuw. (zorg dat het bestand een PDF is)'], 'error');
}
Url_Pin::redirect();
}
}