[CakePHP]The attention of MediaPlugin used on Windows(such as XAMPP)
If you create upload process using MediaPlugin on Windows environment(i.e. XAMPP), you will get failures.
That is to say, you get errors on mkdir(). And it does not save the file pathed “webroot/media/filter/(version name)/transfer/img/(file name)”.
The problem is simple. Because directory separators “\” and “/” are mixed into the path. MediaPlugin only makes a parts of path “transfer/(media type such as img)”. How to solve this problem is modified “plugin/media/models/behaviors/media.php” near on line 161.
[Before modification]
$dirname = substr(str_replace(
str_replace('\\', '/', $baseDirectory),
null,
str_replace('\\', '/', Folder::slashTerm($File->Folder->pwd()))
), 0, -1);
[After modification]
$dirname = substr(str_replace(
str_replace('\\', DS, $baseDirectory),
null,
str_replace('\\', DS, Folder::slashTerm($File->Folder->pwd()))
), 0, -1);
By the way, version1.3 needs the same modifications to solve this.
I don’t know that is true. On Windows, finally, “\” are replaced “\”. I think that this process integrates directory separators. But it will need KAIZEN(= improvements).




