Skip to content

Commit d87b3ad

Browse files
authored
encode string at first to get correctly parts
1 parent 45835ab commit d87b3ad

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/controllers/UploadController.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private function uploadValidator($file)
122122

123123
private function getNewName($file)
124124
{
125-
$new_filename = parent::translateFromUtf8(trim(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)));
125+
$new_filename = parent::translateFromUtf8(trim($this->_pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)));
126126

127127
if (config('lfm.rename_file') === true) {
128128
$new_filename = uniqid();
@@ -166,4 +166,17 @@ function getUrlParam(paramName) {
166166
if (o !== false) o.CKEDITOR.tools.callFunction(funcNum, '$file');
167167
</script>";
168168
}
169+
170+
private function _pathinfo($path, $options = null) {
171+
$path = urlencode($path);
172+
$parts = is_null($options) ? pathinfo($path) : pathinfo($path, $options);
173+
if(is_array($parts)) {
174+
foreach($parts as $field => $value)
175+
$parts[$field] = urldecode($value);
176+
}
177+
else
178+
$parts = urldecode($parts);
179+
return $parts;
180+
}
181+
169182
}

0 commit comments

Comments
 (0)