private void WriteFilePart(IHttpStreamable httpStream, bool prepare, string key, FileLink value) { FileInfo fileInfo = (FileInfo)value.GetInfo(); string fileName = fileInfo.Name; if (NoMediaExtension) { fileName = StringFunc.Substring(fileName, 0, fileName.IndexOf(fileInfo.Extension)); } httpStream.WriteLine("Content-Disposition: form-data; name=\"" + key + "\"; filename=\"" + fileName + "\""); httpStream.WriteLine("Content-Type: " + MimeType.GetByFile(value).Notation); if (!Chunked) { httpStream.WriteLine("Content-Transfer-Encoding: binary"); } httpStream.WriteLine(); httpStream.FlushUnderlying(); if (!prepare) { WriteFile(httpStream, value); } httpStream.WriteLine(); httpStream.FlushUnderlying(); }
protected override void SetContentHeaders(StringStringKeyValuePairContainer headers) { headers.Put(HeaderKeys.ContentType, raw ? EncType.ContentValue : MimeType.GetByFile(fileLink).Notation); headers.Put(HeaderKeys.ContentLength, ContentLength.ToString()); }