我正在尝试使用Node.js将base64图像上传到FaceBook页面.如果我从文件系统中读取文件(即使用fs.readFileSync('c:\ a.jpg'),我已设法让上传工作所有的多部分数据等
但是,如果我使用base64编码的图像并尝试上传它,它会给我以下错误: {"error":{"message":"(#1) An unknown error occurred","type":"OAuthException","code":1}}
我已经尝试将其转换为二进制new Buffer(b64string, 'base64');并上传,但没有运气.
我现在已经为此奋斗了3天,所以任何帮助都会非常感激.
编辑:如果有人也知道如何将base64转换为二进制并成功上传它,这对我也有用.
编辑:代码片段
var postDetails = separator + newlineConstant + 'Content-Disposition: form-data;name="access_token"' + newlineConstant + newlineConstant + accessToken + newlineConstant + separator;
postDetails = postDetails + newlineConstant + 'Content-Disposition: form-data; name="message"' + newlineConstant + newlineConstant + message + newlineConstant;
//Add the Image information
var fileDetailsString = '';
var index = 0;
var multipartBody = new Buffer(0);
images.forEach(function (currentImage) {
fileDetailsString = fileDetailsString + separator + newlineConstant + …Run Code Online (Sandbox Code Playgroud) 我正在考虑开始使用MVVM Light,我遇到了"新的"ICleanup界面.我只是想知道你何时清理VM ...当你离开页面时?
另外,我看到ViewModelLocator中有一个Main Cleanup,它应该清理所有VM ...什么时候使用它?
非常感谢
此致,毛罗
我有一个我为Windows Phone应用程序定义的简单自定义控件.控件的XAML如下:
<UserControl x:Class="PhoneApp1.MyControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
d:DesignHeight="480"
d:DesignWidth="480"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<Grid x:Name="LayoutRoot">
<TextBlock Text="{Binding MyLabel}" />
</Grid>
Run Code Online (Sandbox Code Playgroud)
此外,用户控件具有依赖项属性,如下所示:
public partial class MyControl : UserControl
{
public MyControl()
{
InitializeComponent();
}
public static readonly DependencyProperty MyLabelProperty =
DependencyProperty.Register("MyLabel", typeof (string), typeof (MyControl), new PropertyMetadata(default(string)));
public string MyLabel
{
get { return (string) GetValue(MyLabelProperty); }
set { SetValue(MyLabelProperty, value); }
}
}
Run Code Online (Sandbox Code Playgroud)
现在问题是当我尝试将它数据绑定到我创建的View Model时,没有任何反应.各种代码项如下:
public class MyControlViewModel : ViewModelBase
{
private string …Run Code Online (Sandbox Code Playgroud)