JavaScript send base64 image data to cfc via ajax send base64 image to server,send base64 image to web

I am using html2canvas.js to create a <canvas> image from a div on a page. What I'd like to do is send the rendered base64 image to a cfc via ajax so I can actually save the image to a folder on the server and return the file path to the page.

The issue I am running into is that when I send the base64 encoded data to the cfc, the cfc interprets the data, but with several instances of "[invalid]" within the data.

If I just post the image to the DOM, the image renders just fine. Here is a link to a gist that has both the normal image created compared to the one that I dump from the argument passed into the cfc: https://gist.github.com/ronnieduke/d83dfb3e31677191f88e

Here is the Ajax I am running (where img.src is the result of the canvas data posted in the link above)

var image = new Image();
image.id = 'pic';
// This results in the base64 data posted in image-normal.txt in the gist
image.src = canvas.toDataURL("image/png");
		            
var data =  new FormData();
data.append('imgData',image.src);
		            
// Genrate images in cfc
$.ajax({
  url: 'my.cfc?method=generateImage',
  type:'POST',
  data:data,
  dataType:'JSON',
  processData: false,
  cache:false,
  async:false,
  contentType: false,
  success:function(data){
    console.log(data);
  },
  error:function(result){
    alert(result.responseText);
  }
});
Answer:1

I have the following setup where a custom checkmark is added to style the radio buttons. but it also adds that checkmark to the text type inputs. var changed =function(){ Array.from(...

I have the following setup where a custom checkmark is added to style the radio buttons. but it also adds that checkmark to the text type inputs. var changed =function(){ Array.from(...

I need to take some non-trivial javascript and ensure that all code paths have code that is valid. For example: var num = 1; if (num == 2) { badFunctionName(); } and I need to do this from C#. ...

I need to take some non-trivial javascript and ensure that all code paths have code that is valid. For example: var num = 1; if (num == 2) { badFunctionName(); } and I need to do this from C#. ...

  1. verify javascript code online
  2. verify javascript code
  3. check javascript code
  4. check javascript code online
  5. check javascript code for browser compatibility
  6. check javascript code for errors
  7. check javascript code for errors online
  8. check javascript code syntax
  9. check javascript code quality
  10. check javascript code style
  11. verification code javascript
  12. javascript check code syntax online
  13. javascript check code execution time
  14. javascript check code coverage
  15. age verification javascript code
  16. email verification javascript code

Suppose you have an array that is modified by one asynchronous process and then you have another asynchronous process that reads from the same array. Modifications and reads are done synchronously. ...

Suppose you have an array that is modified by one asynchronous process and then you have another asynchronous process that reads from the same array. Modifications and reads are done synchronously. ...

I'm using divs to make an OnePage Site but I found some problems when the "refresh page" is needed. I can't use the ID a href in this case, but I need to use transitions to change the pages. Can I ...

I'm using divs to make an OnePage Site but I found some problems when the "refresh page" is needed. I can't use the ID a href in this case, but I need to use transitions to change the pages. Can I ...

  1. change pages with javascript
  2. change pages with react
  3. change pages with pdf
  4. change pages to word
  5. change pages in pdf online
  6. change .pages to .doc
  7. change pages to docx
  8. change pages to word online
  9. change pages to word doc
  10. change pages to jpeg
  11. change pages to landscape
  12. change pages to dark mode
  13. change pages to posts wordpress
  14. change pages to american english
  15. change pages in pdf file
  16. change pages in power bi
  17. change pages in html
  18. change pages to word document
  19. change pages in excel
  20. change pages to jpg