Skip to content
Open
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
2 changes: 1 addition & 1 deletion Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function attachFile($filePath, $owner)

$file = new File();

$file->name = pathinfo($filePath, PATHINFO_FILENAME);
$file->name = substr(pathinfo($filePath, PATHINFO_FILENAME), 1); // remove the first '_' added when save to temp folder; hexl 2015-05-10
$file->model = $this->getShortClass($owner);
$file->itemId = $owner->id;
$file->hash = $fileHash;
Expand Down
2 changes: 1 addition & 1 deletion controllers/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function actionUpload()
$result['uploadedFiles'] = [];
if (is_array($model->file)) {
foreach ($model->file as $file) {
$path = $this->getModule()->getUserDirPath() . DIRECTORY_SEPARATOR . $file->name;
$path = $this->getModule()->getUserDirPath() . DIRECTORY_SEPARATOR . '_' . $file->name; // add a '_' to fix chinese file name; hexl 2015-05-10
$file->saveAs($path);
$result['uploadedFiles'][] = $file->name;
}
Expand Down