I looked at preg_replace but str_replace seems to work better.
However, I'm still stuck with using it in the file upload. Should I change the filename before it is uploaded or after it is uploaded?
Is it currently failing when it uploads the image to the server if it has an illegal character or when it is being displayed?
$filename = basename($pic_name);
$illegal = array("%"," ");
$replacement = array("","");
$filename = str_replace($illegal,$replacement,$filename);
copy($pic, "$archive_dir/$filename");
Thanks