Re: QuickForm file element uploading issue
| From: | Alexey Borzov | Date: | Wed, 02 Jun 2004 14:32:57 +0000 |
| Subject: | Re: QuickForm file element uploading issue | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12827@lists.php.net to get a copy of this message | ||
Hi!
Alexander F. Payne wrote:
In trying to use HTML::QuickForm I'm running into an issue previously discussed on this list. In the function I have set up to process my QuickForm-based file upload form I do the following: global $file; if ($file->isUploadedFile()) {My thoughts are: if you do addElement() in a function, then you need to declare $file global there as well. That's basic PHP.$file->moveUploadedFile('uploads');} else {print "No file uploaded";} Other posts to this list indicate that defining $file globally will work if $file is defined in the QuickForm display function: $file =& $form->addElement('file', 'filename', 'File:'); However, when I try to upload files using this code I get the following error: Fatal error: Call to a member function on a non-object in /Library/WebServer/Documents/publications.php on line 161 I'm running PHP 5, if that makes any difference. Thoughts?