How To Save Attachments object to RackSpace Cloud using C#?
<p>I Have one 'System.Net.Mail.Attachment[] attachment' object , This object contains PDF,Xls,Doc or jpg file.</p>

<p>I want to save this attachment object to cloud server.</p>

<pre><code>string sSavePath = "EmailAttachment/" + intSomeid + "/";
  string strErrorMsg = string.Empty;

 if ((attachments != null))
                            {
    MemoryStream memoryStream = new MemoryStream();
    StreamWriter memoryWriter = new StreamWriter(memoryStream);
    memoryWriter.Write(attachments[0]);
    memoryStream.Position = 0;
    CloudFileSystem.SaveFileToCloudSystem(memoryStream, ref strErrorMsg, sSavePath, ConfigHelper.PrivateContainer, attachments[intI].Name);
    memoryWriter.Dispose();
    memoryStream.Dispose();
}
</code></pre>

<p>I have used the above code to save the file.
The File is saved to cloud but having 0 Byte data (Corrupted) File.
I have searched many places for that.
But not able to find error in the code.</p>

<p>Please suggest some solution in this case ?</p>