File upload with single quotes in name

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
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

File upload with single quotes in name

Post by alex.barylski »

Whenever I upload a file which has single quotes everything before the quote goes bye bye :?

I have checked the name before I apply ANY clean up routines directly...

So WTF gives?? Is this a PHP thing? Will safe_mode or something trigger auto filename sanitization or something???

It's NOT my code I promise you that...

Or atleast I think I can promise you that :P

Regards,
Alex
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Are you talking about the filename or the actual file?
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Ambush Commander wrote:Are you talking about the filename or the actual file?
Huh?

The file name...

For instance, if I upload a file called: Alex's Text Document.txt

What I get back when I check $_FILES['upload_file']['name'] is s Text Document.txt...

Make sense now??? :)

The file uploads fine...it's contents, etc...

It's the filename...before any of my code even acts on it....it's stripped of characters preceeding and including the slash... :?

Just curious if this is a *nix thing, apache or php or possibly my script inadvertently changing it...although I don't know how...cuz like I said...my code ain't doing anything before I echo the contents of $_FILES

Any ideas??? Not a major issue....but it's buggin' me I don't know whjats going on :)

Cheers :)
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Unix probably doesn't allow "'" in file names. The moral of the story? Don't rely on the file array to find out what the original name was.
ryanlwh
Forum Commoner
Posts: 84
Joined: Wed Sep 14, 2005 1:29 pm

Post by ryanlwh »

maybe turn magic_quotes_gpc on
Post Reply