0

I have a flow that uploads a file using Zend_Form_Element_File and using an Zend_File_Transfer_Adapter_Http it uploads to the server.

i've modified the flow, and if i already have the file on the server it doesn't show the Zend_Form_Element_File. i need to give the file in the server to the Zend_File_Transfer_Adapter_Http but i can't find a way to achieve this

the main problem i have is that the flow uses the ['tmp_name'] of the file (that is obtained with transfer_adapter)

creation of form element file:

if ($generado==null){
    $element = new Zend_Form_Element_File('file'.$i);
    $element->setDestination(UPLOADS_PATH . "/contratistas/");
    // ensure only 1 file
    $element->addValidator('Count', false, 1);
    // limit to 100K
    $element->addValidator('Size', false, 41943040);
    $element->setRequired();
}else{
    //don't create the file element
} 

Transfer use of the code:

 $upload     = new Zend_File_Transfer_Adapter_Http();
 $upload->setDestination($sDestino);

 if($generado==null){
     $aArchivos  = $upload->getFileInfo();
 }else{
     $aArchivos = $upload->addFile(array("documento.pdf"));
     error_log("ADD FILE");
 }
Fabian W
  • 43
  • 1
  • 7
  • Can you show us the code you tried to use? – Technoh Apr 12 '16 at 20:41
  • i could but its huge, at least 1000 lines @Technoh – Fabian W Apr 12 '16 at 20:45
  • Can you show us the code that's directly relevant to the question, which means the code where you try to pass the `Zend_Form_Element_File` object to the `Zend_File_Transfer_Adapter_Http`? – Technoh Apr 12 '16 at 20:47
  • @Technoh done. the transfer adapter get the files using `getFileInfo()` which gets an array with all the values i will use next – Fabian W Apr 12 '16 at 20:52

0 Answers0