PDA

View Full Version : Single Quotes and file uploads


StupidRalph
02-16-2007, 06:47 AM
It appears that $_FILES['userfile']['name'] does not support single quotes. Whenever I try to upload a file with a single quote it will truncate everything before the quote in the name.
I've been doing some testing but it may actually be the file input type not liking the single quote. Has anyone else had any experiences with this?

C:\Stupid's_File.mp3

after uploading the file it will appear as...

s_File.mp3

relevant code


$filename = str_replace(" ", "_",basename($_FILES['userfile']['name']));

$upload_path = "uploads/" . $genre . "/" . $filename;



I've tried doing some string replaces on this but it appears that the name is truncated before it even gets to the script. And using $_POST['userfile'] returns as an undefined index even tho that is the name of my file input field. Am I missing something?

meth
02-16-2007, 08:04 AM
Turn off magic quotes.

StupidRalph
02-17-2007, 07:18 AM
I think that did the trick. :thumbsup: