Is there a reason why you are trying to receive the same file 2 times ?
Is there a reason why you check for a uploaded file after you received the
uploaded file ? Quite useless to check if the user uploaded it after working
with it.
You should read here for details:
http://www.thomasweidner.com/flatpress/2009/04/17/recieving-files-with-zend_form_element_file/
Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com
----- Original Message -----
From: "Jacky Chen" <[email protected]>
To: "Thomas Weidner" <[email protected]>
Cc: <[email protected]>
Sent: Friday, April 24, 2009 5:55 PM
Subject: Re: [fw-general] problem with form file element
sorry,Thomas,here is the code,
<?php
class IndexController extends Zend_Controller_Action
{
/**
* upload action
*/
public function uploadAction()
{
$form = new Zend_Form();
$form->setEnctype('multipart/form-data');
$form->addElement('file','upload',array('label'=>'choose
file','destination'=>realpath('.')));
$form->upload->setDecorators(array('Label','File','Description','Errors'));
$form->addElement('submit','submit');
if ($this->_request->isPost() &&
$form->isValid($this->_request->getPost()))
{
$values = $form->getValues();
$form->upload->receive();
if ($form->upload->isUploaded()) {
echo 'upload succ';
} else {
echo 'upload fail';
}
}
$this->view->form = $form;
}
}
upload.phtml:
<?php echo $this->form; ?>
upload was succ,but get The file 'upload' was not found error message.
Best Regards
Jacky
2009/4/24 Thomas Weidner <[email protected]>
Hi there,
when i update the latest zend framework from svn, then the form with
file
element was failed when submit the form with a file to upload. It would
get
the error message like The file 'xxxxx' was not found . what's wrong
with
it? How should i fixed it?
By providing your code to the list so people can see what you've done.
;-)
Imagination is not always a good way to get proper help.
Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com