The problem I related in Ap 30:

__

I'm having a peculiar problem with the above component. I'd apreciate any
help.

The following element is being added inside my form class (extending
Zend_Form):

$file = new Zend_Form_Element_File('file_
new');
$fileUploadErrorMessages = array(
    'fileUploadErrorIniSize' => 'O arquivo excede o limite de tamanho
permitido.',
    'fileUploadErrorFormSize' => 'O arquivo  excede o limite de tamanho
permitido.',
    'fileUploadErrorPartial' => 'O arquivo foi parcialmente recebido.',
    'fileUploadErrorNoFile' => 'Nenhum arquivo foi selecionado.',
    'fileUploadErrorNoTmpDir' => 'O arquivo não foi recebido corretamente.',
    'fileUploadErrorCantWrite' => 'O arquivo não foi gravado corretamente.',
    'fileUploadErrorExtension' => 'Erro interno durante o processamento do
arquivo',
    'fileUploadErrorAttack' => 'O arquivo foi enviado de forma incorreta.',
    'fileUploadErrorFileNotFound' => 'Nenhum arquivo foi selecionado',
    'fileUploadErrorUnknown' => 'Erro durante o processamento do arquivo');

// Getting the default Zend_Validate_File_Upload and setting my custom
messages
$file->getValidator('Upload')->setMessages($fileUploadErrorMessages);

_______

/**
 * VALIDATION
 */
$form = new My_Form_Contatos_Importacao();

if ($this->_request->isPost()) {
    $formData = $this->_request->getPost();
    if (!$form->isValid($formData)) {
        print_r($form->getMessages());
        exit;
    }
}
______


When validation fails because of *Zend_Validate_File_Upload::INI_SIZE*, the
message returned is the default:

Array
(
    [file_new] => Array
        (
            *[fileUploadErrorIniSize] => File 'file_new' exceeds the
defined ini size*

        )

)


..But if we have another error, e.g. *Zend_Validate_File_Upload::NO_FILE*,
the custom message is shown:

___

Array

(
    [file_new] => Array
        (

            [fileUploadErrorNoFile] => Nenhum arquivo foi selecionado.
        )

)
_____


Any thoughts?


Thanks in advance,
George
__


On Thu, Jun 17, 2010 at 2:42 PM, Thomas Weidner <thomas.weid...@gmx.at>wrote:

> Which problem?
> A small note of the problem you have would increase the possibility to help
> you.
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
> ----- Original Message ----- From: "sinister2k" <link...@entermotion.de>
> To: <fw-general@lists.zend.com>
> Sent: Thursday, June 17, 2010 10:54 AM
> Subject: [fw-general] Re: Zend_Validate_File_Upload strange behavior
>
>
>
>
>> I've got exactely the same problem :-( Any ideas how to solve this?
>> --
>> View this message in context:
>> http://zend-framework-community.634137.n4.nabble.com/Zend-Validate-File-Upload-strange-behavior-tp2077260p2258433.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>
>

Reply via email to