Hello everyone!

I need some help, I don't find the way for do it , I don't understand what's
going on...

In my controller action:

 public function uploadAction() 
    { 
        ini_set('memory_limit', '512M'); 
        $upload = new Zend_File_Transfer_Adapter_Http();
        
        $upload->setDestination(APPLICATION_PATH.'/../temp/');
        $upload->addValidator('Extension', false, array('xlsx','xls')); 
*        $adapter = new Zend_ProgressBar_Adapter_JsPush();
        $process  = Zend_File_Transfer_Adapter_Http::getProgress($adapter);
        $process = null;
        while (!$process['done']) {
            $process =
$upload->getProgress($process);Zend_Debug::dump($process);
         }*
        try 
        {
            $upload->receive();
            $info = $upload->getFileInfo();
            if(!$upload->isReceived())
            {
                if(strrpos($info['file']['name'], '.xls') != false ||
strrpos($info['file']['name'], 'xlsx') != false)
                {
                    $this->view->errorFile = 'Solo se aceptan los formatos:
xls o xlsx';
                }
                elseif($info['file']['size'] > 10485760)
                {
                     $this->view->errorFile = 'Se alcanzo el tamaño máximo
permitido';
                    
                }
                else 
                {
                     $this->view->errorFile = 'No se pudo subir el archivo';
                }
                return $this->_forward('cartera','index','fidelizacion'); 
            }

        } 
        catch (Zend_File_Transfer_Exception $e) 
        {
             echo $e->message();
        }
    }
}

In my view:
<?php
        $form = new Zend_Form(array(
        'enctype'  => 'multipart/form-data',
        'action'   => '/auth/file/upload',
        'id'   => 'form',
        'elements' => array(
            'file'   => array('file', 
                            array('decorators' => array(
                                'File',
                                'Errors',
                        array(array('data' => 'HtmlTag'),  array('tag' =>'div',
'class'=> 'controls')),
                        array('Label', array('class' => 'control-label')),
                        array(array('row' => 'HtmlTag'), array('tag' => 
'fieldset',
'class' => 'control-group'))
                ))
            ),
            'Upload' => array('submit', 
                array('decorators' => array(
                                'ViewHelper',
                                'Errors',
                        array(array('data' => 'HtmlTag'),  array('tag' =>'div',
'class'=> 'controls')),
                        array(array('row' => 'HtmlTag'), array('tag' => 
'fieldset',
'class' => 'form-actions'))
                        ))
                )
            )
    ));
?>

<div class="fileupload">
    <?php echo $this->errorFile; ?>
    <?php echo $this->form; ?>
    <div id="zend-progressbar-container">
        <div id="zend-progressbar-done"></div>
    </div>

  *  <iframe src=&quot;&lt;?php echo $this->baseUrl.'/auth/file/upload';?>"
id="long-running-process"></iframe>*
</div>





Any help is appreciated.

Thanks and kind regards





--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/How-works-Zend-ProgressBar-Adapter-JsPush-tp4659011.html
Sent from the Zend Framework mailing list archive at Nabble.com.

--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to