note 39654 added to features.file-upload

From: Date: Fri, 06 Feb 2004 10:20:31 +0000
Subject: note 39654 added to features.file-upload
Groups: php.notes 
Request: Send a blank email to php-notes+get-64719@lists.php.net to get a copy of this message
when you upload the file, $_FILES['file']['name'] contains its original name converted into server's default charset. if a name contain characters that aren't present in default charset, the conversion fails and the $_FILES['file']['name'] remains in original charset. i've got this behavior when uploading from a windows-1251 environment into koi8-r. if a filename has the number sign "¹" (0xb9), it DOES NOT GET CONVERTED as soon as there is no such character in koi8-r. Workaround i use: if (strstr ($_FILES['file']['name'], chr(0xb9)) != "") { $_FILES['file']['name'] = iconv ( "windows-1251", "koi8-r", str_replace (chr(0xb9), "N.", $_FILES['file']['name'])); }; ---- Manual Page -- http://www.php.net/manual/en/features.file-upload.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39654 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39654&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39654&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64719) next »