error al llamar al controlador

20 views
Skip to first unread message

Jose Puertas

unread,
Jun 12, 2016, 4:55:14 AM6/12/16
to ZnetDK
Hola Pascal, me esta volviendo loco el porqué desde una vista me llama al controlador de otra vista diferente, te paso los archivos para ver si encuentras el porqué.

En la vista general:

<div id="dlg_documents" class="zdk-modal" title="">
<form id="upload_store_form" class="zdk-form" data-zdk-action="pdfctrl:save">
    <fieldset>
        <label>Seleccionar archivo PDF</label>
        <input type="file" name="pdf_file" data-zdk-action="pdfctrl:upload" required data-zdk-selbuttonlabel="<?php echo LC_BTN_SELECTFILE; ?>">
       <!-- <label>Nombre del archivo</label>-->
        <input name="filename" type ="hidden" required>
        <input name="categoriaarch" type ="hidden" >
        <label>Descripción</label>
        <input name="description" required>
        <legend>Subir archivo</legend>
    </fieldset>
    <button class="zdk-bt-save zdk-close-dialog" type="submit">Enviar</button>
    <button class="zdk-bt-cancel zdk-close-dialog" type="button">Cancelar</button>
</form>

Su controlador:

class PDFCtrl extends \AppController {

    static protected function action_upload() {
        $request = new \Request();
        $fileInfos = $request->getUploadedFileInfos('pdf_file');
        // The uploaded file is stored into the './applications/default/documents'
        // directory with its original name prefixed by the session ID.
        $targetFileName = CFG_DOCUMENTS_DIR . DIRECTORY_SEPARATOR 
            . session_id() . '_' . $fileInfos['basename']; 
        $response = new \Response();
        if (!file_exists($targetFileName)) {
            move_uploaded_file($fileInfos["tmp_name"], $targetFileName);
            $response->setSuccessMessage("Subida", "El archivo '{$fileInfos['basename']}' subido correctamente!");
            $response->downloadedFile = $fileInfos['basename'];
        } else {
            $response->setFailedMessage("Subida", "El archivo '{$fileInfos['basename']}' ya existe!");
        }
        return $response;
    }

En la vista futbol11

<div id="dlg_documents" class="zdk-modal" title="">
<form id="upload_store_form" class="zdk-form" data-zdk-action="pdfcontrollerf11:guardaf11">
    <fieldset>
        <label>Seleccionar archivo PDF</label>
        <input type="file" name="pdf_file_f11" data-zdk-action="pdfcontrollerf11:subidaf11" required data-zdk-selbuttonlabel="<?php echo LC_BTN_SELECTFILE; ?>">
       <!-- <label>Nombre del archivo</label>-->
        <input name="filename" type ="hidden" required>
        <input name="categoriaarch" type ="hidden" >
        <label>Descripción</label>
        <input name="description" required>
        <legend>Subir archivo</legend>
    </fieldset>
    <button class="zdk-bt-save zdk-close-dialog" type="submit">Enviar</button>
    <button class="zdk-bt-cancel zdk-close-dialog" type="button">Cancelar</button>
</form>

Su controlador:

class PDFControllerf11 extends \AppController {
    
static protected function action_subidaf11() {
        $request = new \Request();
        $fileInfos = $request->getUploadedFileInfos('pdf_file_f11');
        // The uploaded file is stored into the './applications/default/documents'
        // directory with its original name prefixed by the session ID.
        $targetFileName = CFG_DOCUMENTSF11_DIR  . DIRECTORY_SEPARATOR 
            . session_id() . '_' . $fileInfos['basename']; 
        $response = new \Response();
        if (!file_exists($targetFileName)) {
            move_uploaded_file($fileInfos["tmp_name"], $targetFileName);
            $response->setSuccessMessage("Subida", "El archivo '{$fileInfos['basename']}' subido correctamente!");
            $response->downloadedFile = $fileInfos['basename'];
        } else {
            $response->setFailedMessage("Subida", "El archivo '{$fileInfos['basename']}' ya existe!");
        }
        return $response;
    }

Saludos
Archivos.rar

Jose Puertas

unread,
Jun 13, 2016, 5:26:38 AM6/13/16
to ZnetDK
Por si sirve de algo estos son los errores que se han guardado el el log.

[2016-06-11 09:24:20] CORE - E_COMPILE_ERROR - Can&#39;t use function return value in write context - C:\xampp\htdocs\club\applications\default\app\controller\pdfcontrollerf11.php(115)
[2016-06-11 09:24:20] CORE - E_COMPILE_ERROR - Can&#39;t use function return value in write context - C:\xampp\htdocs\club\applications\default\app\controller\pdfcontrollerf11.php(115)
[2016-06-11 09:25:03] CORE - E_COMPILE_ERROR - Can&#39;t use function return value in write context - C:\xampp\htdocs\club\applications\default\app\controller\pdfcontrollerf11.php(115)
[2016-06-11 09:25:04] CORE - E_COMPILE_ERROR - Can&#39;t use function return value in write context - C:\xampp\htdocs\club\applications\default\app\controller\pdfcontrollerf11.php(115)
[2016-06-12 10:13:31] CORE - E_ERROR - Uncaught Error: Function name must be a string in C:\xampp\htdocs\club\applications\default\app\controller\pdfcontrollerf11.php:115Stack trace:#0 C:\xampp\htdocs\club\engine\core\appcontroller.php(65): app\controller\PDFControllerf11::action_files()#1 C:\xampp\htdocs\club\engine\core\appcontroller.php(38): AppController::executeAction(&#39;files&#39;)#2 C:\xampp\htdocs\club\engine\core\maincontroller.php(107): AppController::doAction(&#39;files&#39;)#3 C:\xampp\htdocs\club\engine\core\maincontroller.php(132): MainController::executeAction(&#39;pdfcontrollerf1...&#39;, &#39;files&#39;)#4 C:\xampp\htdocs\club\index.php(79): MainController::doAction()#5 {main}  thrown - C:\xampp\htdocs\club\applications\default\app\controller\pdfcontrollerf11.php(115)
[2016-06-12 10:44:59] CORE - E_NOTICE - Undefined property: Response::$setSuccessMessage - C:\xampp\htdocs\club\applications\default\app\controller\pdfctrl.php(15)
[2016-06-12 10:45:16] CORE - E_NOTICE - Undefined property: Response::$setSuccessMessage - C:\xampp\htdocs\club\applications\default\app\controller\pdfctrl.php(15)
[2016-06-12 22:55:52] CORE - ZNETDK ERROR - CTL-003: the controller '' and the action '' does not exist!
[2016-06-12 22:56:02] CORE - ZNETDK ERROR - CTL-003: the controller '' and the action '' does not exist!
[2016-06-12 22:56:04] CORE - ZNETDK ERROR - CTL-003: the controller '' and the action '' does not exist!
[2016-06-12 22:56:05] CORE - ZNETDK ERROR - CTL-003: the controller '' and the action '' does not exist!
[2016-06-12 23:26:43] CORE - E_NOTICE - Undefined property: Response::$setSuccessMessage - C:\xampp\htdocs\club\applications\default\app\controller\pdfctrl.php(17)
[2016-06-12 23:26:44] CORE - E_NOTICE - Undefined property: Response::$downloadedFile - C:\xampp\htdocs\club\applications\default\app\controller\pdfctrl.php(17)

[2016-06-13 11:24:00] CORE - ZNETDK ERROR - UPL-003: the error number '1' occurred during the upload process!
[2016-06-13 11:24:00] CORE - EXCEPTION - UPL-003: the error number '1' occurred during the upload process! - C:\xampp\htdocs\club\engine\core\request.php(266)

Saludos

Pascal Martinez

unread,
Jun 13, 2016, 4:25:21 PM6/13/16
to ZnetDK
Hello José,

El ultimo mensaje abajo significa que el archivo subido esta demasiado grande. 

[2016-06-13 11:24:00] CORE - ZNETDK ERROR - UPL-003: the error number '1' occurred during the upload process!


Saludos,

Pascal MARTINEZ

Jose Puertas

unread,
Jun 14, 2016, 7:21:01 AM6/14/16
to ZnetDK
Solucionado, muchas gracias.


Reply all
Reply to author
Forward
0 new messages