Removing the backslashes when uploading?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Removing the backslashes when uploading?

Post by Dale »

When items get uploaded to one of my sites, if they have a single quote ' in it, the file always gets renamed to \'. (Eg; dale'ssong.mp3 when uploaded ends up as dales\'ssong.mp3) is there a way to stop this?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

If you have the power to do so, turn off magic_quotes_gpc and the other magic quotes settings in php.ini. If not, use stripslashes(). For portablitity to other servers you may want to check if magic quotes is turned on by using the get_magic_quotes_gpc() function ;)
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

Ahh stripslashes() ... why didn't I think of that. :p

Cheers buddy. :)
Post Reply