PHP: How to rename a file uploaded with Zend_Form_Element_File?

前端 未结 7 621
借酒劲吻你
借酒劲吻你 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);
    
    0 讨论(0)
提交回复
热议问题