Image Upload via Live Writer

原创 hamo  2007-04-13 22:44  阅读 1,211 views 次

WordPress has been updated to version 2.1.2, and many friends found that they can't upload images via Windows Live Writer if with PHP 5.2. When publishing a post with a image in it, you will receive an error: "Image Upload Not Surpport by Weblog". And in the wp-content/upload folder, the images exist there but the file names is wrong.

But when it was WordPress version 2.0, it works well.

How do you get this to work?

The first solution is to degrade the PHP version to 4.2.x. If you host your webserivice on Dreamhost, it's a good solution.

But sometime you can't change your PHP version, and now, rockyzh post a solution here:

Modify from line 138 of wp-includes/class-IXR.php as below:

function parse() {
// first remove the XML declaration
$rx = '/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m';
if (preg_match($rx, $this->message, $m)) {
$encoding = strtoupper($m[1]);
} else {
$encoding = "UTF-8";
}
// $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message);
// if (trim($this->message) == '') {
// return false;
// }
$this->_parser = xml_parser_create($encoding);

I have not tested the solution, some one reports it working but some others said no.

本文地址:https://www.satwe.com/archives/253.html
关注我们:请关注一下我们的微信公众号:扫描二维码哈默博客的公众号,公众号:aiboke112
版权声明:本文为原创文章,版权归 hamo 所有,欢迎分享本文,转载请保留出处!

发表评论


表情