C# 使用xmlrpc c将图像添加到drupal 7节点#
我正在尝试将图像添加到节点中。我在网上搜索了一下,但没找到多少。我想我需要先上传图像,然后将其添加到节点中,这就是为什么我写了一些代码将图像添加到文件夹(sites/all/default)中,但没有成功。我在XmlRpcClientProtocol.cs中遇到一些错误-“无法将文件写入目标” 使用file.create方法C# 使用xmlrpc c将图像添加到drupal 7节点#,c#,drupal,xml-rpc,image-uploading,C#,Drupal,Xml Rpc,Image Uploading,我正在尝试将图像添加到节点中。我在网上搜索了一下,但没找到多少。我想我需要先上传图像,然后将其添加到节点中,这就是为什么我写了一些代码将图像添加到文件夹(sites/all/default)中,但没有成功。我在XmlRpcClientProtocol.cs中遇到一些错误-“无法将文件写入目标” 使用file.create方法 XmlRpcStruct file = new XmlRpcStruct(); file.Add("file", encodedData);
XmlRpcStruct file = new XmlRpcStruct();
file.Add("file", encodedData);
file.Add("filename", filename);
file.Add("filepath", "sites/default/files/" + filename);
file.Add("filesize", filestream.Length);
file.Add("timestamp", DateTime.Now.ToShortTimeString());
drupal.FileSave(file);
有什么建议吗?在Python中:
将open(filepath+name_Urb')作为f:
img=base64.b64编码(f.read())
size=os.path.getsize(文件路径+名称)
文件={'methodCall':
{'s':
{'param':
{'struct':
{'member':[
{'name':'filesize','value':{'string':str(size)},
{'name':'filename','value':{'string':str(文件路径+名称}},
{'name':'file','value':{'string':str(img)},
{'name':'filepath','value':{'string':'public://product_image/“+str(name_)}”,
]
}
}
},
'methodName':'file.create'
}
}
xml=dict2xml.dict2xml(文件)