/[cvs]/nfo/php/libs/org.netfrag.patches/phphtmllib/forms/UploadForm.php
ViewVC logotype

Contents of /nfo/php/libs/org.netfrag.patches/phphtmllib/forms/UploadForm.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Wed May 5 17:55:40 2004 UTC (20 years, 2 months ago) by jonen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +15 -3 lines
 added notify-msg

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

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed