[the-board/wip/http-api: 6/6] fix chrome
- From: Lucas Rocha <lucasr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [the-board/wip/http-api: 6/6] fix chrome
- Date: Wed, 24 Nov 2010 23:03:50 +0000 (UTC)
commit 2badb8d4456cc50f00b7f12d92f87ec371bfc409
Author: Lucas Rocha <lucasr gnome org>
Date: Wed Nov 24 22:30:31 2010 +0000
fix chrome
src/chrome/background.js | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)
---
diff --git a/src/chrome/background.js b/src/chrome/background.js
index 1d42ce7..1c7d55b 100644
--- a/src/chrome/background.js
+++ b/src/chrome/background.js
@@ -20,23 +20,17 @@ function callMethod(methodName, args, onLoad, onError) {
req.open("POST", encodeURI(url), true);
var boundaryString = "AaBbCcX30";
- var boundary = "--"+boundaryString;
-
- var postContent = "\r\n"+boundary+"\r\n"+
- "Content-Disposition: form-data; name=\"comment\"\r\n"+
- "\r\n"+
- "Comment is another input\r\n"+
- boundary+"\r\n"+
- "Content-Disposition: file; name=\"uploadedfile\"; filename=\"image.png\"\r\n"+
- "Content-Type: image/png\r\n"+
- "\r\n"+
- "%FILECONTENT%\r\n"+
- boundary+"\r\n";
-
- postContent = postContent.replace("%FILECONTENT%", args.imageData);
+ var boundary = "--" + boundaryString;
req.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + boundaryString);
+ var postContent = boundary+"\r\n" +
+ "Content-Disposition: form-data; name=\"file\"; filename=\"image.png\"\r\n" +
+ "Content-Type: application/octet-stream\r\n" +
+ "\r\n" +
+ args.imageData + "\r\n" +
+ boundary+"--\r\n";
+
var onStateChange = function() {
if (req.readyState == 4) {
var json;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]