I have a API method where I am create zip file in a stream
MemoryStream outputMemStream = new MemoryStream();
ZipOutputStream zipStream = new ZipOutputStream(outputMemStream);
FileInfo fi = new FileInfo(version.File.ContentFilePath);
string entryName = ZipEntry.CleanName(fi.Name);
ZipEntry newEntry = new ZipEntry(entryName);
newEntry.DateTime = fi.LastWriteTime;
newEntry.Size = fi.Length;
zipStream.PutNextEntry(newEntry);
byte[] buffer = new byte[4096];
using (FileStream streamReader = File.OpenRead(fi.FullName))
{
StreamUtils.Copy(streamReader, zipStream, buffer);
}
zipStream.CloseEntry();
zipStream.IsStreamOwner = false;
zipStream.Close();
outputMemStream.Position = 0;
long fileLength;
long startOffset;
long endOffset;
bool isPartial = false;
string errMessage = string.Empty;
Stream fs = FileUpDownHelper.GetPartialFileStream(outputMemStream, out fileLength, out startOffset, out endOffset, out isPartial, out errMessage);
return fs;
Then I need send this file, but I have a problem, that I cannot change the file name. And file name always = method name. How can I fix this without creating a file?