ECWorks Blog

ECWorks Blog

CakePHPを中心としたサイト開発情報をメインに公開。新しもの好きなので時々製品レポートなんかも。

[CakePHP]The attention of MediaPlugin used on Windows(such as XAMPP)

cake-logoIf 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).

Tagged as: ,

このエントリをはてなブックマークに追加 このエントリをLivedoor Clipに追加 このエントリをYahoo!ブックマークに追加 このエントリをdel.icio.usに追加 このエントリをFC2ブックマークに追加 このエントリをNifty Clipに追加 このエントリをPOOKMARK. Airlinesに追加 このエントリをBuzzurl(バザール)に追加 このエントリをChoixに追加 このエントリをnewsingに追加 

Leave a Response

Comment moderation is enabled. Your comment may take some time to appear.