4

「指定されたパスの形式はサポートされていません」というメッセージが表示されます。SDL Tridion 2011 SP1からマルチメディアイメージをダウンロードしようとしているとき、以下は私が取得しているパスです。「N:」などがどのように表示されるかはわかりません。

D:\ delete \ Images \ N:\ dmc.FlipMedia.Clients.TestCMS \ 2009_WorkInProgress \creatives \ 05_May\16歳未満の子供は英国に無料で行きます\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" '.
4

2 に答える 2

5

おそらく今までに理解したように、string file = "D:\\delete\\Images\\" + multimediaComponent.BinaryContent.Filename;完全なファイル名(パスを含む)を追加するため、間違ったパスが生成されます。

次のようなものを使用してみてくださいstring file = "D:\\delete\\Images\\" + Path.GetFilename(multimediaComponent.BinaryContent.Filename);

于 2012-12-19T12:02:05.130 に答える
0

このようにしてください:-

Stream tempStream = streamDownloadClient.DownloadBinaryContent(tcmId);
MemoryStream memoryStream = new MemoryStream();
int b;
do
{
    b = tempStream.ReadByte();
    memoryStream.WriteByte((byte)b);
} while (b != -1);

binaryContent = memoryStream.ToArray();​
于 2012-12-19T13:43:11.817 に答える