1 |
udo |
1.1 |
<? |
2 |
|
|
/** |
3 |
|
|
* This file contains the UploadForm child class. |
4 |
|
|
* |
5 |
|
|
* |
6 |
|
|
* @package org.netfrag.patches |
7 |
|
|
* @name UploadForm |
8 |
|
|
* |
9 |
|
|
*/ |
10 |
|
|
|
11 |
|
|
/** |
12 |
|
|
* Cvs-Log |
13 |
|
|
* |
14 |
udo |
1.4 |
* $Id: UploadForm.php,v 1.3 2003/11/14 18:04:13 udo Exp $ |
15 |
udo |
1.2 |
* |
16 |
|
|
* $Log: UploadForm.php,v $ |
17 |
udo |
1.4 |
* Revision 1.3 2003/11/14 18:04:13 udo |
18 |
|
|
* fixed textArea dependent to _show_items and _set_items |
19 |
|
|
* |
20 |
udo |
1.3 |
* Revision 1.2 2003/11/14 17:51:20 udo |
21 |
|
|
* changed label-text |
22 |
|
|
* |
23 |
udo |
1.2 |
* Revision 1.1 2003/11/14 17:02:28 udo |
24 |
|
|
* initial commit |
25 |
udo |
1.1 |
* |
26 |
|
|
* |
27 |
|
|
* |
28 |
|
|
*/ |
29 |
|
|
|
30 |
|
|
class UploadForm extends StandardFormContent { |
31 |
|
|
|
32 |
|
|
function UploadForm($title, $width) { |
33 |
|
|
// something that has to be executed BEFORE parent constructor |
34 |
|
|
// |
35 |
|
|
//$this->_feFile = new FEFile("testfile", TRUE, 20); |
36 |
|
|
// |
37 |
|
|
$parent = get_parent_class($this); |
38 |
|
|
$this->$parent($title, $PHP_SELF, $width=600); |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
function form_init_elements() { |
42 |
|
|
|
43 |
|
|
//print_r "scandir($this->_uploaddir)"; |
44 |
|
|
|
45 |
|
|
// add hidden element for page control |
46 |
|
|
$this->add_hidden_element( 't', 'News' ); |
47 |
|
|
$this->add_hidden_element( 'subtopic', 'upload' ); |
48 |
|
|
$this->set_confirm(false); |
49 |
|
|
$this->add_element( new FEFile("File")); |
50 |
|
|
|
51 |
|
|
} |
52 |
|
|
function form_init_data() { |
53 |
|
|
// ??? |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
|
57 |
|
|
function form_content() { |
58 |
|
|
$this->add_form_block("Waehlen Sie hier ein neues Bild aus:", $this->_upload() ); |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
function &_upload() { |
62 |
|
|
$table = &html_table($this->_width, 0, 2); |
63 |
|
|
$table->add_row($this->element_label("File"),$this->element_form("File") ); |
64 |
|
|
|
65 |
|
|
return $table; |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
|
69 |
|
|
function form_action() { |
70 |
|
|
|
71 |
|
|
global $app; |
72 |
|
|
|
73 |
|
|
$tmp = $this->get_element("File"); |
74 |
|
|
$fileInformation = $tmp->get_file_info(); |
75 |
|
|
if ($fileInformation["tmp_name"] > "") { |
76 |
|
|
|
77 |
|
|
$uploadfile = $app->getConfig("path.news.img.archive") . $fileInformation["name"]; |
78 |
|
|
|
79 |
|
|
/* the destination-name of the uploaded film is hardcoded, but not the suffix (.jpg ....) |
80 |
|
|
* so we have to ensure that there are no double files with the same filename but different suffixes |
81 |
|
|
* in the online - folder |
82 |
|
|
* |
83 |
|
|
*/ |
84 |
|
|
|
85 |
|
|
if (move_uploaded_file($fileInformation["tmp_name"], $uploadfile)) { |
86 |
|
|
print "File was successfully uploaded. "; |
87 |
|
|
//print_r($_FILES); |
88 |
|
|
} else { |
89 |
|
|
print "File not uploaded\n"; |
90 |
|
|
//print_r($_FILES); |
91 |
|
|
} |
92 |
|
|
} |
93 |
|
|
|
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
function form_backend_validation() { |
97 |
|
|
//$this->set_action("Confirm"); |
98 |
|
|
return TRUE; |
99 |
|
|
} |
100 |
|
|
|
101 |
|
|
|
102 |
|
|
function &_user_info() { |
103 |
|
|
$table = &html_table(100,0,2); |
104 |
|
|
$table->add_row($this->element_label("File"), $this->element_form("File")); |
105 |
|
|
|
106 |
|
|
return $table; |
107 |
|
|
} |
108 |
|
|
|
109 |
|
|
} |
110 |
|
|
|
111 |
udo |
1.2 |
?> |