Skip to content
Open

utf8 #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions nbproject/private/private.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
copy.src.files=false
copy.src.target=/home/da/public_html/CakePHP-FileUpload-Plugin
index.file=
run.as=LOCAL
url=http://localhost/CakePHP-FileUpload-Plugin/
7 changes: 7 additions & 0 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_5
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=true
web.root=.
9 changes: 9 additions & 0 deletions nbproject/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>CakePHP-FileUpload-Plugin</name>
</data>
</configuration>
</project>
16 changes: 15 additions & 1 deletion vendors/uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ function processFile($file = null){
//if callback returns false hault the upload
if(!$fileName){
return false;
}
}
$fileName = $this->clearUTF($fileName);
$target_path = $up_dir . DS . $fileName;
$target_path = $this->__handleUnique($target_path);

Expand Down Expand Up @@ -343,5 +344,18 @@ function _multiArrayKeyExists($needle, $haystack) {
return false;
}

function clearUTF($s){
setlocale(LC_ALL, 'en_US.UTF8');
$r = '';
$s1 = iconv('UTF-8', 'ASCII//TRANSLIT', $s);
for ($i = 0; $i < strlen($s1); $i++){
$ch1 = $s1[$i];
$ch2 = mb_substr($s, $i, 1);

$r .= $ch1=='?'?$ch2:$ch1;
}
return $r;
}

}
?>