I'm having problem in saving the canvas image data with the specific title in hte input text. It saved in the server but you need to rename ("name.png") it in the php file.
and my javascript is this:HTML Code:<input type="text" id="titlecanvas" name="title" size="30" /> <input type="button" id = "RoSave" value="Save my drawing!" onclick="RoSave(this.frm);">
and the php file is:Code:function RoSave(frm) { var data = document.getElementById("RoCanvas").toDataURL('image/png'); var ajax = new XMLHttpRequest(); ajax.open("POST",'file_path/canvass.php',false); ajax.setRequestHeader('Content-Type', 'application/upload'); ajax.send(data); }
I need to get the input name so that it will be the name of the Image that will be saved to the server.PHP Code:if (isset($GLOBALS["HTTP_RAW_POST_DATA"]))
{
$imageData=$GLOBALS['HTTP_RAW_POST_DATA'];
$filteredData=substr($imageData, strpos($imageData, ",")+1);
$unencodedData=base64_decode($filteredData);
$fp = fopen('name.png', 'wb' );
fwrite( $fp, $unencodedData);
fclose( $fp );
}
Please Help!![]()
![]()


Reply With Quote
Bookmarks