Ich bin neu zu zend, ich versuche, eine CSV-Datei hochzuladen und seinen Inhalt zu bekommen. Meine Form-Klasse istWie bekomme ich hochgeladen Datei Info in Zend1
<?php
class Application_Form_Upload extends Zend_Form
{
public function init()
{
// Set the method for the display form to POST
$this->setMethod('post')->setEnctype('multipart/form-data');
// Add an email element
$this->addElement('text', 'email', array(
'label' => 'Your email address:',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
'EmailAddress',
)
));
// Add the comment element
$this->addElement('file', 'csvfile', array(
'label' => 'CSV File:',
'required' => true
));
// Add the submit button
$this->addElement('submit', 'submit', array(
'ignore' => true,
'label' => 'Send Request',
));
// And finally add some CSRF protection
$this->addElement('hash', 'csrf', array(
'ignore' => true,
));
}
}
Mein Controller
class IndexController extends Zend_Controller_Action {
public function indexAction() {
$this->view->headTitle('WestWing');
$request = $this->getRequest();
$form = new Application_Form_Upload();
if ($this->getRequest()->isPost()) {
if ($form->isValid($request->getPost())) {
$formData = new Application_Form_Upload($form->getValues());
echo "<pre>";
print_r($formData);
$fileName = $formData->file->tmp_name;
echo $fileName;
}
} else {
echo "anot well";
}
$this->view->form = $form;
}
}
aber wenn ich echo $filename
tun, es gibt mir nichts.