2012-08-26 120 views
0

我有重命名文件的問題。我需要新的文件名稱是西里爾文,但是,當在img文件夾中重命名img時,新名稱是「РҐСРРСССССРРР'РССРμРІ.jpg」。這是我的代碼:Zend Framework:重命名上傳文件

$newName = $formdata['name']; 

try { 
     $ext = end(explode('.', $form->img3->getFileName())); 
     path = (APPLICATION_PATH . '/../public/imgs/' . $newName . '.') . $ext; 

     $form->img3->addFilter('Rename', array('target' => $path, 
         'overwrite' => true)); 

     $form->img3->receive(); 

     $form->reset(); 
    } 
     catch (Exception $e) 
     { 
     $editMessage[][] = 'Invalid image.'; 
     } 

回答

1

嘗試:

$path = (APPLICATION_PATH . '/../public/imgs/' . $newName . '.') . $ext; 
$path = iconv('utf-8', 'cp1251', $path); 
+0

謝謝,固定我的問題。 – Defense