0

hi,

i am looking at using a html5 script that helps draw on a canvas, how can i then save this to my database in a blob to then be shown again on the page at a later date?

the code is:

function RoSave(frm)
{    
    var strImageData = canvas.toDataURL();  

    $.ajax({
        url: "#", // place your Ajax URL here
        type: "post",
        data: "image_data="+encodeURIComponent(strImageData)+"&title="+frm.title.value
            +"&author="+frm.author.value,
        success: function(msg)
        {
           // on success output some message or redirect etc

what should i place in the url part? the php page whtat will save this?

and what shold my php page look like? i know how to do insert updates etc in php but not sure about this?

many thanks

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by glenn2407
0
url: "canvasSaveData.php",

canvasSaveData.php

<?php
//check logged in?
//include('app.php');
//if(loggedin){
//$_POST['image_data'] & $_POST['title'] & $_POST['author']
$Q = "INSERT into canvasdata (`fields`) VALUES ('$data')";
//run query
?>

not used the jquery version of ajax so not sure how to get the page responseText

Edited by Biiim: forgot to show post vars

0

hi sir kindly give the full step on how to save the canvas.
the table used in the database , also the fields.
how about the ajax url,
please!
tnx.

Edited by glenn2407

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.