6

I checked previous questions here on SO but I think I want my functionality to work a little different. I understand that .tif files are not natively supported in Internet Explorer and that an extension, such as AlternaTIFF, are available to remedy this. However, I would like the dialog to show up where the user can either save/open the file on the client side. I know that MS Windows Picture and Fax Viewer can open them, no problems.

The files are located on our servers and this will be an intranet site. Currently, I have a link to the files populate in the view but again, I'd like that option for the user to Save/Open the file.

I'm using MVC, which I'm a little unfamiliar with, and can't seem to figure this one out. Thank you.

4

1 回答 1

1

您可以通过更改标题来执行返回 tiff 的操作,这样当有人单击链接时,文件将被下载或使用 FileResult。

FileResult 示例(我发现它更容易):http ://www.dotnetcurry.com/ShowArticle.aspx?ID=807

保存它们就像使用 MVC 上传任何文件一样。这篇文章很有用http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx

我的建议是在使用 GDI+ 上传时将它们转换为 .jpg 或 .png。

//You first upload the tiff to the server like the post above explains
//And then open and convert it to .JPEG
Bitmap bm = Bitmap.FromFile("mypic.tiff");
bm.Save("mypic.jpg",ImageFormat.JPEG);

如果您已经拥有所有 tiff 的 url,您可以随时使用控制台应用程序来转换所有这些。即使您需要使用 tiff,在网络上显示 .jpg 版本也是一个好主意。您甚至可以调整它们的大小以创建预览并节省一些带宽!:-)

于 2012-11-28T15:18:16.170 回答