File: D:/HostingSpaces/SBogers10/lab.komma-mediadesign.nl/wwwroot/lab/controllers/c_uploader.class.php
<?php
/**
* c_uploader.class.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 4/15/13
*/
class Uploader extends Controller
{
public function __construct()
{
parent::__construct();
}
/*
* Gets the dashboard of our homepage
*/
public function index()
{
$jsOutput = $this->getJs();
$this->View->setData('js_output',$jsOutput);
// Title
$this->View->setData('page_title','Simple Uploader | ' . SITE_NAME);
$this->View->setData('page_name','page_uploader');
// Render view
$this->View->render('v_uploader');
}
public function upload()
{
echo '<pre>';
print_r($_FILES);
echo '</pre>';
}
private function getJs()
{
return '<script type="text/javascript" src="/js/simpleuploader/jquery.form.js"></script>
<script type="text/javascript">
$(function() {
var bar = $(\'.bar\');
var percent = $(\'.percent\');
var status = $(\'#status\');
$(\'#ajax_form\').ajaxForm({
beforeSend: function() {
status.empty();
var percentVal = \'0%\';
bar.width(percentVal)
percent.html(percentVal);
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + \'%\';
bar.width(percentVal)
percent.html(percentVal);
},
complete: function(xhr) {
status.html(xhr.responseText);
}
});
});
</script>';
}
}