2011-06-03 141 views
3

我正在做以下使用codeigniter上傳文件(圖片)。我所想要做的是,這樣很明顯的字段錯誤涉及過,因爲在頁面上多次上傳選項,下面是我上傳的代碼,codeigniter文件上傳

$config['upload_path'] = './media/uploads/users'; 
      $config['allowed_types'] = 'gif|jpg|png'; 
      $config['max_size'] = '1000'; 
      $config['max_width'] = '90'; 
      $config['max_height'] = '60'; 

      $this->upload->initialize($config); 

      if(!$this->upload->do_upload('logo_small')) 
      { 
       $error = array('error' => $this->upload->display_errors()); 
       $this->template->build('users/employer', $error); 
      } 
      else 
      { 
       $file = $this->upload->data(); 
       $logo_small = "small_".$file['file_name']; 
      } 

所以基本上我想有錯誤修改錯誤信息消息在錯誤消息中標記Logo Small,然後如果錯誤與Logo等有關,我希望它聲明。

回答

2

最簡單的方法是用你想要的錯誤信息編輯system/language/english/upload_lang.php。 enter image description here

+3

@Krish:編輯系統/核心文件是個不錯的選擇。如果您找不到特定語言的語言包,則可以始終使用應用程序/語言/製作文件夾,並從系統/語言/英語/中複製所有語言文件。在您的配置中,將默認語言更改爲您命名文件夾的任何內容。然後,你可以在application/language/yourlang /中的文件中進行破解。首先在這裏發佈堆棧溢出,因此無法將其作爲評論發佈。它沒有解決多文件問題。看一看CI論壇;我記得之前在那裏讀過關​​於它的一些東西。 – 2011-06-29 14:39:43

+0

^^^同意! ^^^ – saada 2013-10-29 19:21:13

+0

你甚至不需要複製所有的語言文件。只需在應用程序/語言/英文/文件夾下複製要覆蓋的文件即可。無論你寫的是否覆蓋系統/語言/英語/ – saada 2013-10-29 20:49:50