hello all
i'm using the PHP copy command to implement an "upload attachment" functionality in a HTML form.
my problem is that the user is allowed to upload filenames containing special characters, e.g. French accents.
when i use the following command though the special character in the filename is replaced in the new directory.
is there any way i can stop this from happening?
btw i'm using Windows 7.

PHP command:
copy($_FILES[$file_obj_name]["tmp_name"], $target_path . $filename);

original filename:
Régularisation.docx

new filename (conversion done during PHP copy):
Régularisation

    The name isn't actually being changed, it's just being interpreted with the wrong encoding. Changing the encoding from UTF-8 (which is what it looks like is being used) to Windows-1251 ought to fix it. See [man]iconv[/man].

      thanks Weedpacket - it works now!

      i used the following command:
      copy($_FILES[$file_obj_name]["tmp_name"], $target_path . iconv("UTF-8", "ISO-8859-1//TRANSLIT", $filename));

      ISO-8859-1 works for French accents.

        Write a Reply...