HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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();
    }
}