使用c#返回文件操作方法查看更多图像 [英] view more number of images using c# return file action methos

查看:76
本文介绍了使用c#返回文件操作方法查看更多图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的MVC应用程序中使用以下代码显示图像这是我的控制器的代码



Hi, i'm already display images using the following code in my MVC application this is the code of my controller

var recordEventUploadFile = new RecordEventUploadFile();
           var ext="";
           var filePath = "";
           int i=0;
           var fileDetails = _reportReviewActionMethods.GetUploadFilePath(fileId);
           recordEventUploadFile.FilePath = fileDetails.FilePath;
           recordEventUploadFile.FileExtension = fileDetails.FileExtension;
           filePath = recordEventUploadFile.FilePath;
           var fileExtension = recordEventUploadFile.FileExtension;
           string[] ExtensionWODot = fileExtension.Split('.');
           if (ExtensionWODot[1].ToLower()== "pdf")
               ext = "application/" + ExtensionWODot[1].ToLower();
           else
           {
               ViewBag.ImagePath = fileDetails;
               return File(filePath, "image/" + ExtensionWODot[1].ToLower());
           }
           return File(filePath, ext);





它成功显示图像但是现在我想通过调用这个动作方法在单个窗口中加载图像组怎么能我加载那组图像?请告诉我



it sucessfully display image but now I want to load group of images in single window by calling this action method how can I load those group of images? please tell me

推荐答案

由于CP网站问题,评论按钮现在不可用,因此我将此作为解决方案发布,当评论按钮返回时,将其重新定位为注释。



您显示的代码是方法的摘录;不知道该方法返回的内容很难给你反馈。



如果你想要显示的代码来处理多个文件,那么你必须显然,给它一些方法来传入一个文件列表,或者在一个变量中可用,或者你必须传入一个目录路径,然后从该目录中选择符合你条件的文件(和/或它的子目录)。



为什么不从实现开始,但是方法会知道哪些文件...或者,如何查找文件。 ..你想要显示?
The "Comment" button is not available right now because of a CP site problem, so I'll post this as a "solution," and re-locate it as comment when the "Comment" button returns.

The code you show is an excerpt from a method; without knowing what is done with what the method returns it is hard to give you feedback.

If you want the code you show to handle multiple files, then you have to, obviously, give it some way to have a list of files passed in, or available in a variable, or you have to have a directory path passed in, and then select the files that match your criteria from within that directory (and/or its sub-directories).

Why don't you start by implementing however it is the method will know what files ... or, how to find the files ... you want displayed ?


这篇关于使用c#返回文件操作方法查看更多图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆