PHP: How to rename a file uploaded with Zend_Form_Element_File?

前端 未结 7 623
借酒劲吻你
借酒劲吻你 2021-02-01 16:25

Form:

//excerpt
$file = new Zend_Form_Element_File(\'file\');
$file->setLabel(\'File to upload:\')
    ->setRequired(true)
    ->addValidator(\'NotEmp         


        
7条回答
  •  日久生厌
    2021-02-01 17:31

    // For Zend Framework :: Rename Uploaded File

     $renameFile = 'newName.jpg';
    
     $fullFilePath = '/images/'.$renameFile;
    
     // Rename uploaded file using Zend Framework
     $filterFileRename = new Zend_Filter_File_Rename(array('target' => $fullFilePath, 'overwrite' => true));
    
     $filterFileRename -> filter($name);
    

提交回复
热议问题