QuickForm - missing $_FILES data
| From: | Branden Faulls | Date: | Fri, 04 Apr 2003 17:51:13 +0000 |
| Subject: | QuickForm - missing $_FILES data | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-4650@lists.php.net to get a copy of this message | ||
Trying to use Quickform as part of an image upload script. When I try to access the uploaded file in the $_FILES array, it is always empty. Using a simple form of my own, I am able to access the $_FILES data without fail.
var_dump($_FILES); with a QuickForm returns nothing.
Do I have to reinstatiate the same QuickForm inorder to process the form data? The Quickform source code doesn't point to this. Very confused here.
Sample Code
-----------------------------------------
<?php
require_once('myAuth.php'); //an instantiation of Auth
require_once('HTML/QuickForm.php');
//if myAuth.php finds the user is authenticated
// it will call this function
function page_content()
{
if(!$_FILES['imgfile']) {
upload_form('No file uploaded!');
}
else {
/*********************************************
* validate the image
********************************************/
}
}
//no post data, show form
function upload_form($errMsg)
{
$page = new HTML_Page();
$form = new HTML_QuickForm('img_upl', 'post');
$img = &HTML_QuickForm::createElement('file','imgfile');
$smb = &HTML_QuickForm::createElement('submit', null, 'Submit');
$form->addHeader('Enter image to upload:');
$form->addElement($img);
$form->addElement($smb);
$page->body = "";
if(!empty($errMsg)){
$page->body .= "Errors were encountered uploading your file:<br>";
$page->body .= $errMsg;
$page->body .= "Please try again.<br>";
}
$page->body = $form->toHtml();
$page->display();
}
?>
-----------------------------------------
Versions
-----------------------------------------
PHP - 4.1.2
Apache - 1.3.26
PEAR - 1.0.1
HTML_Quickform - 2.10
-----------------------------------------
Any help would be appreciated.
Thanks
Branden
--
+-----------------------------omphe.com-+
| |
|Branden Faulls |
| |
| www.omphe.com |
| brandenfaulls@omphe.com |
| (+44) 773 440 8623 |
+---------------------------------------+