ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Post canvas image data to entry via Safecracker

November 01, 2011 5:47pm

Subscribe [1]
  • #1 / Nov 01, 2011 5:47pm

    etsisk

    42 posts

    Hello,

    I’m trying to figure out how submit canvas image data as part of an entry using SafeCracker / SafeCracker File.

    I’ve tried using jQuery to assign file input with the img source data

    $(document).ready(function(){
      var img = canvas.toDataURL("image/png");
      var url = $('img').attr('src');
      $('input:file').val(url);
    });

    +

    <script type="text/javascript"> 
        document[dot]write(''+img+') 
    </script>
    
    {exp:safecracker channel="my_channel" return="safe_cracker/results"}
    <input name="title" type="text">
    <input name="my_custom_field" type="file">
    <input name="submit" type="submit">
    {/exp:safecracker}


    but I run into security issues.

    Any suggestions?

  • #2 / Nov 02, 2011 10:15am

    etsisk

    42 posts

    Got it.

    Instead of trying to save it as a file, I am sending the canvas data as a string to a text input field. Seems to be working so far.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases