* refactored the tsPage::[get|set]Request to tsUrl::[get|set]Request
[vsc.git] / adm / _pages / upload / code.php
blob1660f1468684745c81ba24a195a1103463e98188
1 <?php
2 /*switch ($_FILES['uploadFile']['error']) {
3 case 1:
4 // '<p> The file is bigger than this PHP installation allows</p>';
5 break;
6 case 2:
7 // '<p> The file is bigger than this form allows</p>';
8 break;
9 case 3:
10 // '<p> Only part of the file was uploaded</p>';
11 break;
12 case 4:
13 // '<p> No file was uploaded</p>';
14 break;
17 class upload extends tsAdminPage {
18 public function __construct(){
19 parent::__construct();
21 $this->varArray['title'] = 'adm';
23 $action = tsUrl::getRequest('do');
25 if (empty ($action)) {
26 $action = 'display';
29 $this->$action();
32 private function display () {
33 $dir = UPLOAD_PATH;
34 $upl = new tsFile ($dir);
36 $t = $upl->getChildren();
38 foreach ($t as $key => $file) {
39 $out[$key]['id'] = $key;
40 $out[$key]['url'] = $file->icon;
41 $out[$key]['path'] = $file->URL;
42 $out[$key]['name'] = $file->name;
44 $out[$key]['mimetype'] = $file->type;
47 $this->varArray['pics'] = $out;
48 $this->varArray['URL'] = BASE_URL;
49 $this->varArray['action'] = tsUrl::setRequest(get_class($this), 'do=upload');
52 private function upload () {
53 // at the moment we'll have only one upload
54 if (!empty($_FILES)) {
55 $fName = $_FILES['f']['name'];
56 $upload = UPLOAD_PATH.DIRECTORY_SEPARATOR.$fName;
58 //$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
59 $t = move_uploaded_file ($_FILES['f']['tmp_name'] , $upload);
60 var_dump($_FILES,$t);
62 // tsPage::redirect(tsUrl::setRequest(get_class($this)));