Cannot get PHP to upload and post a client side (javascript) image to an easyblog post
<p>I want to add a button on my site so that users can click on a java script button and have it display an image directly into the easyblog forum with one click. The forum can be seen at <a href="http://stackideas.com/easyblog.html" rel="nofollow">http://stackideas.com/easyblog.html</a>. The code i have now is below. It just needs some minor modifications, but I am stuck on what to do to modify it. The site I am using this code is at: www.investprofits.com</p>

<p><strong>THIS IS THE CLIENT SIDE CODE OF THE BUTTON</strong> (On 1 page):</p>

<pre><code>&lt;script type="text/javascript"&gt;
function retrieveChart(){ var width = 640; var height = 460; var imageData = document.FnChartsApplet10.getChartAsBase64EncodedPNG(width, height);
if(imageData != ""){ document.imageform.imagedata.value = imageData; return true; }}&lt;/script&gt;
&lt;form name="imageform" action="displayimage.php" method="POST" target="_blank"&gt;
&lt;input type="submit" value="Export chart as PNG" onclick="javascript:retrieveChart()"&gt;
&lt;input type="hidden" name="imagedata" value=""&gt;
&lt;/form&gt;
</code></pre>

<p>*<em>THIS IS THE SERVER SIDE CODE *</em>(placed on the server):</p>

<pre><code>&lt;?php
if(isset($_POST['imagedata']) &amp;&amp; $_POST['imagedata'] != ""){
$imagedata = base64_decode($_POST['imagedata']);
header("Content-Type: image/png");
$date = gmdate("D, d M Y H:i:s") . " GMT";
header("Last-Modified: " . $date);
header("Expires: " . $date);
header("Cache-Control: max-age=0");
header("Content-Disposition: attachment; filename=\"fncharts_export.png\"");
header("Content-Length: " . strlen($imagedata));
echo $imagedata;
} else {
header("Content-Type: text/plain");
echo "Image not available!";
}
?&gt;
</code></pre>

<p>As it stands now, this code produces a png image of a stock chart and displays it in a new browser. However, I want to change the code (above) so the chart image will be uploaded to the easyblog with the click of the javascript button.</p>

<p>NOTE: Users will already be logged in. Therefore, the rule: "Only allowed users are allowed to upload images" should not be a problem.
I know i need to modify the code above (and possibly make some changes to the EasyBlog file: media.php. But, I am stuck on how to make these changes. </p>
