Re: [fw-general] Bug with Zend_File_Transfer

2008-09-18 Thread Jacky Chen
thanks your rapid reply.

2008/9/19 Thomas Weidner <[EMAIL PROTECTED]>

> Jacky,
>
> this is not supported for now and has been reported several times in the
> last few days.
> A issue is already filled and in work.
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
> - Original Message - From: "Jacky Chen" <[EMAIL PROTECTED]>
> To: 
> Sent: Friday, September 19, 2008 8:47 AM
> Subject: [fw-general] Bug with Zend_File_Transfer
>
>
>
>  it seem that each validation for the file elements in the zend_form would
>> validate all of the file elements in the form.it means that if there have
>> two file elements in the form,says A and B. So isValid() for the element A
>> is called,it would validate A and B,not just A.
>>
>> So if i want to upload two files, one is option, and another is
>> required,then would result in error if i left the option one empty.
>>
>> do you understand me? if you don't , try the following:
>>
>> >
>> $form = new Zend_Form();
>> $form->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
>>
>> // file a,optional
>> $a = new Zend_Form_Element_File('A');
>> $a->setLabel('file a');
>> $form->addElement($a);
>>
>> // file b,required
>> $b = new Zend_Form_Element_File('B');
>> $b->setLabel('file b');
>> $b->setRequired(true);
>> $form->addElement($b);
>>
>> if ($this->_request->isPost()) {
>>   if ($form->isValid($_POST)) {
>>   echo 'valid';
>>   } else {
>>   echo 'invalid';
>>   }
>> }
>> echo $form;
>>
>>
>


Re: [fw-general] Bug with Zend_File_Transfer

2008-09-18 Thread Thomas Weidner

Jacky,

this is not supported for now and has been reported several times in the 
last few days.

A issue is already filled and in work.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: "Jacky Chen" <[EMAIL PROTECTED]>

To: 
Sent: Friday, September 19, 2008 8:47 AM
Subject: [fw-general] Bug with Zend_File_Transfer



it seem that each validation for the file elements in the zend_form would
validate all of the file elements in the form.it means that if there have
two file elements in the form,says A and B. So isValid() for the element A
is called,it would validate A and B,not just A.

So if i want to upload two files, one is option, and another is
required,then would result in error if i left the option one empty.

do you understand me? if you don't , try the following:

setEnctype(Zend_Form::ENCTYPE_MULTIPART);

// file a,optional
$a = new Zend_Form_Element_File('A');
$a->setLabel('file a');
$form->addElement($a);

// file b,required
$b = new Zend_Form_Element_File('B');
$b->setLabel('file b');
$b->setRequired(true);
$form->addElement($b);

if ($this->_request->isPost()) {
   if ($form->isValid($_POST)) {
   echo 'valid';
   } else {
   echo 'invalid';
   }
}
echo $form;





[fw-general] Bug with Zend_File_Transfer

2008-09-18 Thread Jacky Chen
it seem that each validation for the file elements in the zend_form would
validate all of the file elements in the form.it means that if there have
two file elements in the form,says A and B. So isValid() for the element A
is called,it would validate A and B,not just A.

So if i want to upload two files, one is option, and another is
required,then would result in error if i left the option one empty.

do you understand me? if you don't , try the following:

setEnctype(Zend_Form::ENCTYPE_MULTIPART);

// file a,optional
$a = new Zend_Form_Element_File('A');
$a->setLabel('file a');
$form->addElement($a);

// file b,required
$b = new Zend_Form_Element_File('B');
$b->setLabel('file b');
$b->setRequired(true);
$form->addElement($b);

if ($this->_request->isPost()) {
if ($form->isValid($_POST)) {
echo 'valid';
} else {
echo 'invalid';
}
}
echo $form;


Re: [fw-general] Bug with Zend_File_Transfer

2008-09-11 Thread Thomas Weidner

No, actually it should not.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: "Jacky Chen" <[EMAIL PROTECTED]>

To: 
Sent: Thursday, September 11, 2008 9:32 AM
Subject: [fw-general] Bug with Zend_File_Transfer



Hi there,

there is a bug in the Zend_File_Transfer_Abstract::setOptions() , the code
in the setOptions() as bellow:

if (is_array($options)) {
$this->_options += $options;
}


Maybe the following code should it be:

if (is_array($options)) {
   $this->_options = $options + $this->_options;
}





[fw-general] Bug with Zend_File_Transfer

2008-09-11 Thread Jacky Chen
Hi there,

there is a bug in the Zend_File_Transfer_Abstract::setOptions() , the code
in the setOptions() as bellow:

if (is_array($options)) {
 $this->_options += $options;
}


Maybe the following code should it be:

if (is_array($options)) {
$this->_options = $options + $this->_options;
}