• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
codeigniter routing problem with http POST

#1
[eluser]Unknown[/eluser]
In my MY_Controller.php I have

public function _remap($method, $args) {
$postfix = @$_SERVER['REQUEST_METHOD'] ? $_SERVER['REQUEST_METHOD'] : 'GET';
if ( ! method_exists($this,"{$method}_{$postfix}")) {
show_404();
}
call_user_func_array(array($this, "{$method}_{$postfix}"), $args);
}

In my config/routes.php, I have

$route['apps/upload'] = 'apps/app_upload/upload';

In my CI controller `apps/app_upload.php`, I have a `upload_POST` function and `upload_GET` function. sending HTTP GET request to `/apps/upload` works fine. however, sending HTTP POST request to `/apps/upload` doesn't hit the `_remap` function at all, hence never reach the upload_POST function.

what could be the problem here?

#2
[eluser]Unknown[/eluser]
oops, the above code works perfectly and the fault is at my testing script. ;/


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.