无法将原始数据从swf通过POST转换为图像

I have here a swf file that will send a base64 encoded to PHP via POST. Now I'm getting the string via $dataCode = file_get_contents("php://input");

What i want to achieve is to convert the base64 encoded from swf to image through PHP and save it to specific folder.

Here's my code but for the meantime i just stripped it to see if imagecreatefromstring is returning a true value and output the image on the page:

    $dataCode = file_get_contents("php://input");
    $dataCode = explode("=", $dataCode);
    $data = $dataCode[1];

    $imageData = rawurldecode($data);
    $source = imagecreatefromstring($imageData);

    if ($source !== false) {
        header('Content-Type: image/png');
        imagepng($source);
        imagedestroy($source);
    }
    else {
        echo 'An error occurred.';
    }

Then after this i will save it to folder and i will output the url of the image via XML.

Something like this:

header("Content-Type:application/rss+xml");        
echo '<?xml version=\"1.0\"?>
<data>
  <result status="1">
    <url>'.$basepath.'converted.jpg'.'</url>
  </result>
</data>';

The ERROR is the imagecreatefromstring is returning false value, If you encountered this problem please help. I don't know if the image is corrupted or am I doing something wrong here. Any suggestions or help is great. Thanks.

On your listing, you've decoded with rawurldecode(). try using base64_decode()