Page 1 of 1

Special Characters in File upload

Posted: Sat Feb 06, 2010 3:41 am
by dharprog
Hi All,

This is new situation for me how to handle the Special characters in File upload before sending to either php file which handles the file.

I want to change the file name or remove the special characters like single quote (') or Double quote like ("), &, # as i am getting the word broken to php page.

I just want to make it in the client side only as i am using ajax and while sending the request to php the url is breaking.

So please anyone guide me in this situation how to handle this.

Thanks and regards,
DharProg

Re: Special Characters in File upload

Posted: Sat Feb 06, 2010 10:10 am
by AbraCadaver
Use escape() on that portion of the URL. It encodes the special characters for use in a URL. It's similar to the PHP urlencode() function.

Re: Special Characters in File upload

Posted: Sat Feb 06, 2010 10:16 am
by Eran
escape() should be avoided for URLs. Use encodeURIComponent() instead
http://xkr.us/articles/javascript/encode-compare/

Re: Special Characters in File upload

Posted: Sat Feb 06, 2010 11:16 am
by AbraCadaver
pytrin wrote:escape() should be avoided for URLs. Use encodeURIComponent() instead
http://xkr.us/articles/javascript/encode-compare/
Good to know, thanks!

Re: Special Characters in File upload

Posted: Sat Feb 06, 2010 10:00 pm
by dharprog
Hi All,

Thanks for your support but i could not find the url where it is generating as it is ajaxupload.js file from Jquery.

How to find and where can i see the url to apply escape?

Please guide me.

Thanks and regards,
DharProg.

Re: Special Characters in File upload [Solved]

Posted: Mon Feb 08, 2010 4:02 am
by dharprog
Hi All,

It is solved with the following solution changing the php.ini setting:

magic_quotes_gpc = off.

If there is any other solution is there please provide me without changing the php.ini.

Thanks for all your support,

Dharprog