我正在使用 FileResult 在我的网站中显示文件,如下所示:
public ActionResult GetSwf(long id = 0)
{
if (id <= 0) return null;
Attachment attachment = Service.GetAttachmentById(id);
if (attachment == null) return null;
string filename = attachment.Name;
string mimeType = "application/x-shockwave-flash";
string absoluteFilePath = UploadedPaths.GetAbsolutePath(attachment.Path);
return File(absoluteFilePath, mimeType, filename);
}
它不适用于以下标签,浏览器将下载文件而不是显示它!
<object type="application/x-shockwave-flash" width="220" height="166" data="File/GetSwf/1232" class="flash-object" data-name="ads-file"></object>
出了什么问题,我该如何解决?