使用Angularjs$http插入ContentVersion

使用Angularjs$http插入ContentVersion,angularjs,curl,salesforce,visualforce,salesforce-chatter,Angularjs,Curl,Salesforce,Visualforce,Salesforce Chatter,我一直在尝试使用Salesforce Chatter插入文件,但它已被用于curl。我无法找到如何在Angularjs中使用带有visualforce的$http实现同样的功能。我无法正确设置请求标头和正文。如果必须使用javascript而不是curl来完成,请提供请求的标题和正文内容 创建新文档的示例 创建新文档的请求主体示例 此代码是newdocument.json的内容。为简洁起见,PDF内容的二进制数据已被省略并替换 实际请求包含完整的二进制内容 --boundary_string C

我一直在尝试使用Salesforce Chatter插入文件,但它已被用于curl。我无法找到如何在Angularjs中使用带有visualforce的$http实现同样的功能。我无法正确设置请求标头和正文。如果必须使用javascript而不是curl来完成,请提供请求的标题和正文内容

创建新文档的示例 创建新文档的请求主体示例 此代码是
newdocument.json
的内容。为简洁起见,PDF内容的二进制数据已被省略并替换 实际请求包含完整的二进制内容

--boundary_string
Content-Disposition: form-data; name="entity_document";
Content-Type: application/json

{
"Description" : "Marketing brochure for Q1 2011",
"Keywords" : "marketing,sales,update",
"FolderId" : "005D0000001GiU7",
"Name" : "Marketing Brochure Q1",
"Type" : "pdf"
}

--boundary_string
Content-Type: application/pdf
Content-Disposition: form-data; name="Body"; filename="2011Q1MktgBrochure.pdf"

Binary data goes here.

--boundary_string--
尝试使用。也要确保。尝试使用。也一定要记住。
--boundary_string
Content-Disposition: form-data; name="entity_document";
Content-Type: application/json

{
"Description" : "Marketing brochure for Q1 2011",
"Keywords" : "marketing,sales,update",
"FolderId" : "005D0000001GiU7",
"Name" : "Marketing Brochure Q1",
"Type" : "pdf"
}

--boundary_string
Content-Type: application/pdf
Content-Disposition: form-data; name="Body"; filename="2011Q1MktgBrochure.pdf"

Binary data goes here.

--boundary_string--