Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用xmlrpc c将图像添加到drupal 7节点#_C#_Drupal_Xml Rpc_Image Uploading - Fatal编程技术网

C# 使用xmlrpc c将图像添加到drupal 7节点#

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);

我正在尝试将图像添加到节点中。我在网上搜索了一下,但没找到多少。我想我需要先上传图像,然后将其添加到节点中,这就是为什么我写了一些代码将图像添加到文件夹(sites/all/default)中,但没有成功。我在XmlRpcClientProtocol.cs中遇到一些错误-“无法将文件写入目标”

使用file.create方法

     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(文件)