javascript - jQuery Mobile form submission with signature image -
I'm using jQuery signer pad here, with source and demo:
now All this shows the image of your signature when you click, now with the image on the page, how can I submit my form.
I am sending my form to a PDF converter named MPDF using a modified version:
To get an image on PDF, I want to get it from the picture on the page Now what to do, as you click on submitting it, there is no information in dragging that image.
> I am not the most lover in PHP because any help I am learning will be greatly appreciated.
Update Code provided by Thanasus Grammotopolos
function fun_submit () {If (isSign) {var canvas = $ ("# canvas") Get (0); Var imgData = canvas.toDataURL (); // To change the code here, do not display the image, it was sent to Server $ .AJX ({type: "POST", url: "script.php", data: {imgBase64: imgData}}. O) {Warning ('Sub-limit'.);}); ClosePopUp (); } And {warnings ('please sign in'); } }
PHP:
& lt ;? Php define ('UPLOAD_DIR', 'up /'); $ Img = $ _POST ['IMGData']; $ Img = str_replace ('data: image / png; base64,', '', $ img); $ Img = str_replace ('', '+', $ img); $ Data = base64_decode ($ img); $ File = UPLOAD_DIR Unicode () '.png'; $ Success = file_put_contents ($ file, $ data); ? & Gt; Still provides a 0kb .png file on the server with nothing on it. Where do I go from here?
You just have to send an image to the server, change your code to:
Function fun_submit () {if (isign) {var canvas = $ ("# canvas"). Get (0); Var imgData = canvas.toDataURL (); // To change the code here, do not display the image, it was sent to Server $ .AJX ({type: "POST", url: "script.php", data: {imgBase64: imgData}}. O) {Warning ('Sub-limit'.);}); ClosePopUp (); } And {warnings ('please sign in'); }} More info here:
Comments
Post a Comment