2012-11-06 26 views
0

我有以下懷疑:如何在應用程序目錄之外調用我的模型或codeigniter控制器?

我有我的codeigniter項目使用Flash。其結構如下:

name_proyect 
     application/
      controller/
      model/
      view/
     audiofiles/ 
      //Here are being saved all audios. 
     user_guide/
     flash/
      archivos.swf 
      save_audio.php 
     system/
     index.php 

閃光燈使用save_audio.php文件,該文件保存在我的服務器上的音頻。 但是,當我在我的服務器上保存物理文件時,還需要將我的數據庫中與該用戶關聯的文件路徑保存。

我的問題是,我可以使用活動記錄笨的文件save_audio.php嗎? o我可以使用我的模型或控制器在我的項目中使用模型來保存數據庫?

注:save_audio.php是一個簡單的腳本(不是類)

+0

你想使用'save_img.php'或'save_audio.php'文件? – diEcho

+0

btw你的音頻文件保存在哪裏?你可以通過'base_url()或'site_url()'來檢索它。希望它有道理? – diEcho

+0

@diEcho我的歉意,我錯了文件save_img.php。我想使用save_audio.php – user6964

回答

0

移動save_audio.php的當前內容爲CI控制器。如果可以,請編輯Flash文件,以便將文件/請求發送到新位置。

如果您無法更新Flash文件,請刪除save_audio.php,以便配置項將提取請求,並使用路由配置將路徑路由到CI內的新控制器。在這種情況下,你最終會是這樣的:

應用/控制器/ upload.php的 - 新創建的控制器

class Upload extends CI_Controller { 
    public function handle_audiofile() { 
     // the original content of the save_audio.php comes here. 
     // might need to update some superglobal usage 
    } 
} 

的application/config/routes.php文件

$route['application/flash/save_audio.php'] = 'upload/handle_audiofile'; 
相關問題