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");
}