开发者

CodeIgniter and params with square brackets

开发者 https://www.devze.com 2023-02-10 07:18 出处:网络
I\'m using CodeIgniter and I have a controller which processes uploads using AJAX. The controller expects to receive the name of the file as paramater, therefore I need to accept almost any kind of p

I'm using CodeIgniter and I have a controller which processes uploads using AJAX.

The controller expects to receive the name of the file as paramater, therefore I need to accept almost any kind of possible character in the URL.

My JavaScript encode the file name using encodeURI(), therefore a file named "My File [x].avi" becomes "My%20file%20%5BX%5D.mpg". Everything fine so far.

Problem comes when receiving that parameter into CodeIgniter. The URL looks like http://localhost/myproject/uploader/upload/My%20file%20%5BX%5D.avi

And the header of the controller:

function upload($param1='') { }

When I print $param1 I got:

string(8) "My_file_" 

Even if I use urldecode() it remains the same. Therefore CodeIgniter is eating the encoded square brackets. Any help?

Thank you so much i开发者_如何学Gon advance.


I think you have $config['global_xss_filtering'] set to true and so CI is cleaning the vars. If this is the case, you can either set it to false or tweak input->xss_clean function.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号