JavaScript Why the WebKitFormBoundary error when I send an image from Chrome to Rails?

In my Google Chrome Extension I have:

function submitScreenshot() {
  chrome.tabs.captureVisibleTab(
    null, 
    function(img) {
      var xhr = new XMLHttpRequest(), formData = new FormData();  
      formData.append("img", img);
      formData.append("height", localStorage["tabHeight"]);
      formData.append("width", localStorage["tabWidth"]);
      formData.append("surveyID", localStorage["ID"]);
      xhr.open("POST", "http://localhost:3000/task/screenshot", true);
      xhr.setRequestHeader('Authorization', 'Token token=<redacted>');
      xhr.send(formData);
     }
   );
 }

In my Rails app I have:

def screenshot
  response = JSON.parse(request.body.read.html_safe)
  img = request.filtered_parameters["img"]
  survey = Survey.find_by(:id => response["surveyID"])
  survey.area.screenshot = img
  survey.area.save!
  survey.area.update_columns :screenshot_width => request.filtered_parameters["width"], :screenshot_height => request.filtered_parameters["height"]
  head 200
end

Why then am I getting this error?

JSON::ParserError (757: unexpected token at '------WebKitFormBoundary6BJ6BvfXeLjByMbN
Answer:1

I have a problem with connection to a database with mongoose on localhost. In my server.js file I have: var express = require('express'); var app = express(); //...

I have a problem with connection to a database with mongoose on localhost. In my server.js file I have: var express = require('express'); var app = express(); //...

  1. node js mongodb
  2. node js mongodb tutorial
  3. node js mongodb example
  4. node.js mongodb example application
  5. node js mongodb connection
  6. node js mongodb find by id
  7. node js mongodb find example
  8. node js mongodb driver
  9. node js mongodb update by id
  10. node js mongodb find
  11. node js mongodb example github
  12. node js mongodb crud
  13. node js mongodb user authentication
  14. node.js mongodb find toarray
  15. node js mongodb aggregate query
  16. node js mongodb authentication
  17. node js mongodb connection pool
  18. node js mongodb rest api
  19. node js mongodb insert
  20. node.js mongodb search engine

This is my Html5 code.. Problem is that "Text is not fully read by the voice. It stops in half way."What I need to do for that? Am using the script inside the html <!DOCTYPE html> <html ...

This is my Html5 code.. Problem is that "Text is not fully read by the voice. It stops in half way."What I need to do for that? Am using the script inside the html <!DOCTYPE html> <html ...

  1. html5 javascript text to speech
  2. html5 javascript text
  3. html5 javascript copy text to clipboard
  4. html5 javascript input text
  5. html5 javascript write text file
  6. html5 javascript create text file
  7. html5 javascript change button text
  8. html5 script typeu003d text/javascript srcu003d
  9. javascript html5 canvas draw text
  10. html5 typeu003d text/javascript
  11. html5 script typeu003d text/javascript
  12. html5 javascript draw text
  13. html5 typeu003d text/javascript 不要

I have a template in which photos are being displayed in a frame ( each frame is different for different images) .I have written a function which uses the images original height and width and gives me ...

I have a template in which photos are being displayed in a frame ( each frame is different for different images) .I have written a function which uses the images original height and width and gives me ...

what i need is, When i click on button "Click", the Column "Delete" Should be visible and editable. and when i click on the same button "click" again, the delete column should slide right and hide ...

what i need is, When i click on button "Click", the Column "Delete" Should be visible and editable. and when i click on the same button "click" again, the delete column should slide right and hide ...

  1. show hide div sliding effect