gpt4 book ai didi

tridion - 尝试从 Tridion 2011 SP1 下载多媒体图像时不支持获取文件路径

转载 作者:行者123 更新时间:2023-12-02 13:46:59 27 4
gpt4 key购买 nike

我收到“不支持给定路径的格式。”当我试图从 SDL Tridion 2011 SP1 下载多媒体图像时,下面是我得到的路径,不知道“N:”等是如何出现的。

D:\delete\Images\N:\dmc.FlipMedia.Clients.TestCMS\2009_WorkInProgress\creatives\05_May\Kids under 16 go free to UK\assets_graphics\jpg\Kids_go_free_385x306.jpg

下面是代码:

 public static void GetBinaryFromMultimediaComponent(string tcm, CoreServiceClient client, StreamDownloadServiceClient streamDownloadClient)
{

ComponentData multimediaComponent = client.ReadItem(tcm) as ComponentData;

// Generate you own file name, and file location
string file = "D:\\delete\\Images\\" + multimediaComponent.BinaryContent.Filename;//Here I am getting above path

// Write out the existing file from Tridion
FileStream fs = File.Create(file);//Here getting the exception
byte[] binaryContent = null;

if (multimediaComponent.BinaryContent.FileSize != -1)
{
Stream tempStream = streamDownloadClient.DownloadBinaryContent(tcm);
var memoryStream = new MemoryStream();
tempStream.CopyTo(memoryStream);
binaryContent = memoryStream.ToArray();
}

fs.Write(binaryContent, 0, binaryContent.Length);
fs.Close();
}

请推荐!!

编辑:

我使用 Nuno Suggestions 获得了文件名,但是继续进行

 Stream tempStream = streamDownloadClient.DownloadBinaryContent(tcm);

我遇到以下错误,对此有什么建议吗?

The content type multipart/related; type="application/xop+xml";start="";boundary="uuid:5f66d04b-76d3-4d3a-b8e3-b7b91e00ed32+id=2";start-info="text/xml" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 595 bytes of the response were: ' --uuid:5f66d04b-76d3-4d3a-b8e3-b7b91e00ed32+id=2 Content-ID: Content-Transfer-Encoding: 8bit Content-Type: application/xop+xml;charset=utf-8;type="text/xml" '.

最佳答案

正如您现在可能已经想到的,string file = "D:\\delete\\Images\\"+ multimediaComponent.BinaryContent.Filename;将附加完整的文件名(包括路径)和因此生成错误的路径。

尝试使用类似 string file = "D:\\delete\\Images\\"+ Path.GetFilename(multimediaComponent.BinaryContent.Filename);

关于tridion - 尝试从 Tridion 2011 SP1 下载多媒体图像时不支持获取文件路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13951691/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com