您能为 asp.net-mvc 推荐替代 FileUpload 控件吗?

发布于 2024-07-08 17:11:58 字数 359 浏览 5 评论 0原文

目前使用 System.Web.UI.WebControls.FileUpload 包装在我们自己的控件中。

我们拥有 Telerik 的许可证。 我想知道是否有人有这方面的经验或可以提出更好的建议?

本地化来衡量的一些标准

  • 通过验证
  • 性能
  • 多个文件
  • 浏览很困难)
  • 安全

Currently using System.Web.UI.WebControls.FileUpload wrapped in our own control.

We have licenses for Telerik. I wanted to know if anyone had experience with that or could suggest a better one?

Some criteria to be measured by

  • validation
  • peformance
  • multiple files
  • localisation (browse is difficult)
  • security

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

謌踐踏愛綪 2024-07-15 17:11:58

就我个人而言,如果您有 Telerik 控件,我会尝试一下。 我发现它们非常有帮助,而且用户体验也很好。 他们的上传控制非常好。

Personally, if you have the Telerik controls I would give them a shot. I've found that they are very helpful, and the user experience is good. Their upload control is quite nice.

姐不稀罕 2024-07-15 17:11:58

我刚刚在另一个问题中发布了这个问题,但是如果您使用此 ActiveX 控件您将能够快速有效地处理图像。 该组件实际上会在发送图像之前在客户端计算机上调整图像的大小。 这减少了不必要的带宽并一次传输多个图像。

I just posted about this in another question, but if you use this ActiveX control you will be able to process images quickly and efficiently. The component will actually resize the images on the client machine before sending them. This reduces unnecessary bandwidth and transfers multiple images at one time.

酷炫老祖宗 2024-07-15 17:11:58

看看这个:

Html-5-Uploader

将多个文件拖放到您的网页上!

链接并不总是有效,所以这里又是: http://www.igloolab.com/ jquery-html5-uploader/

控制器:(根据我的原始代码修改,希望我不要忘记一些东西,但它很清楚)

     <HttpPost()> _
     Public Function Upload(uploadedFile As System.Web.HttpPostedFileBase) As ActionResult
        If uploadedFile IsNot Nothing Then 
            If uploadedFile.ContentLength > 0 Then

               Dim mimeType As String = Nothing 
                'Upload
                Dim PathFileName As String =   System.IO.Path.GetFileName(uploadedFile.FileName)

                 Dim path =  System.IO.Path.Combine(Server.MapPath("~/App_Data/Uploads"), PathFileName)

                If Not System.IO.Directory.Exists(Path) Then
                    System.IO.Directory.CreateDirectory(Path)
                End If

                Dim firstLoop As Boolean = True
                uploadedFile.SaveAs(path)                  
             Next
        End If
        Return Nothing
    End Function

这是视图(不要忘记指向 css 和 js 的链接;))

     <h1>
            @SharedStrings.Upload</h1>
        <h2>
            @SharedStrings.UploadInformation</h2>
        <div id="dropbox">
        </div>
        <div id="upload">
        </div>
        <script type="text/javascript">

            $(function () {

                var fileTemplate = "<div id=\"{{id}}\">"; fileTemplate += "<div class=\"progressbar\"></div>"; fileTemplate += "<div class=\"preview\"></div>"; fileTemplate += "<div class=\"filename\">{{filename}}</div>"; fileTemplate += "</div>"; function slugify(text) { text = text.replace(/[^-a-zA-Z0-9,&\s]+/ig, ''); text = text.replace(/-/gi, "_"); text = text.replace(/\s/gi, "-"); return text; }
                $("#dropbox").html5Uploader({ onClientLoadStart: function (e, file) {
                    var upload = $("#upload"); if (upload.is(":hidden")) { upload.show(); }
                    upload.append(fileTemplate.replace(/{{id}}/g, slugify(file.name)).replace(/{{filename}}/g, file.name));
                }, onClientLoad: function (e, file) { /*$("#" + slugify(file.name)).find(".preview").append("<img src=\"" + e.target.result + "\" alt=\"\">");*/ }, onServerLoadStart: function (e, file) { $("#" + slugify(file.name)).find(".progressbar").progressbar({ value: 0 }); }, onServerProgress: function (e, file) { if (e.lengthComputable) { var percentComplete = (e.loaded / e.total) * 100; $("#" + slugify(file.name)).find(".progressbar").progressbar({ value: percentComplete }); } }, onServerLoad: function (e, file) { $("#" + slugify(file.name)).find(".progressbar").progressbar({ value: 100 }); } 
                }); 
            });
        </script>

和我的 css

 /*html 5 uploader*/
#dropbox 
{
/*picture where people would drag-drop their files to*/
 background-image:url(../Images/UploadToMedia.png);
 height:128px;
 margin-bottom:40px;
 margin-left:auto;
 margin-right:auto;
 background-repeat:no-repeat;
 margin-top:0;
 width:128px;
}

Check this one out:

Html-5-Uploader

Drag-and-drop multiple files on your webpage!

Link doesn't always work so here it is again: http://www.igloolab.com/jquery-html5-uploader/

.

Controller: (modified from my original code, hope i don't forgot something, but it's pretty clear)

     <HttpPost()> _
     Public Function Upload(uploadedFile As System.Web.HttpPostedFileBase) As ActionResult
        If uploadedFile IsNot Nothing Then 
            If uploadedFile.ContentLength > 0 Then

               Dim mimeType As String = Nothing 
                'Upload
                Dim PathFileName As String =   System.IO.Path.GetFileName(uploadedFile.FileName)

                 Dim path =  System.IO.Path.Combine(Server.MapPath("~/App_Data/Uploads"), PathFileName)

                If Not System.IO.Directory.Exists(Path) Then
                    System.IO.Directory.CreateDirectory(Path)
                End If

                Dim firstLoop As Boolean = True
                uploadedFile.SaveAs(path)                  
             Next
        End If
        Return Nothing
    End Function

This is the View (don't forget links to css and js ;))

     <h1>
            @SharedStrings.Upload</h1>
        <h2>
            @SharedStrings.UploadInformation</h2>
        <div id="dropbox">
        </div>
        <div id="upload">
        </div>
        <script type="text/javascript">

            $(function () {

                var fileTemplate = "<div id=\"{{id}}\">"; fileTemplate += "<div class=\"progressbar\"></div>"; fileTemplate += "<div class=\"preview\"></div>"; fileTemplate += "<div class=\"filename\">{{filename}}</div>"; fileTemplate += "</div>"; function slugify(text) { text = text.replace(/[^-a-zA-Z0-9,&\s]+/ig, ''); text = text.replace(/-/gi, "_"); text = text.replace(/\s/gi, "-"); return text; }
                $("#dropbox").html5Uploader({ onClientLoadStart: function (e, file) {
                    var upload = $("#upload"); if (upload.is(":hidden")) { upload.show(); }
                    upload.append(fileTemplate.replace(/{{id}}/g, slugify(file.name)).replace(/{{filename}}/g, file.name));
                }, onClientLoad: function (e, file) { /*$("#" + slugify(file.name)).find(".preview").append("<img src=\"" + e.target.result + "\" alt=\"\">");*/ }, onServerLoadStart: function (e, file) { $("#" + slugify(file.name)).find(".progressbar").progressbar({ value: 0 }); }, onServerProgress: function (e, file) { if (e.lengthComputable) { var percentComplete = (e.loaded / e.total) * 100; $("#" + slugify(file.name)).find(".progressbar").progressbar({ value: percentComplete }); } }, onServerLoad: function (e, file) { $("#" + slugify(file.name)).find(".progressbar").progressbar({ value: 100 }); } 
                }); 
            });
        </script>

And my css

 /*html 5 uploader*/
#dropbox 
{
/*picture where people would drag-drop their files to*/
 background-image:url(../Images/UploadToMedia.png);
 height:128px;
 margin-bottom:40px;
 margin-left:auto;
 margin-right:auto;
 background-repeat:no-repeat;
 margin-top:0;
 width:128px;
}
染年凉城似染瑾 2024-07-15 17:11:58

我们扩展了 FileUploadControl 以添加一些验证。 我们还编写了自己的控件,允许一次上传多个文件。 我们目前正在评估两者。 希望我们决定其中一个,我不想维护 2 个不同的上传控件。

We extended the FileUploadControl to add some validation. We also wrote our own control that allows multiple files to be uploaded at once. We are currently evaluating both. Hopefully we decide on one, I would hate to have 2 different upload controls to maintain.

爱格式化 2024-07-15 17:11:58

查看 Dean Brettle 的 NeatUpload。 它基本上是一个自定义 HttpHandler,可将文件流式传输到磁盘,并具有额外的可配置性。 它是开源的,Dean 绝对是支持用户的明星。

Check out Dean Brettle's NeatUpload. It's basically a custom HttpHandler that streams files to disk with loads of extra configurability. It's open source and Dean is an absolute star for supporting his users.

听你说爱我 2024-07-15 17:11:58

您可以尝试基于 Flash 的解决方案,该解决方案允许您显示任何文本、文本框、按钮或其他任何内容,作为您自己的文件上传控件的一部分。 这些解决方案通常会在页面上放置一个 1x1 flash 影片,作为 javascript 和 flash 之间的桥梁,以便 javascript 可以动态调用 flash 的文件上传框。

在最近的一个项目中,我使用 FancyUpload 来做到这一点。

You could try a flash-based solution that allows you to display whatever text, textboxes, buttons, or anything else as part of your own file upload control. These solutions typically put a 1x1 flash movie on the page that acts as a bridge between javascript and flash such that javascript can call flash's file upload box dynamically.

In a recent project, I used FancyUpload to do exactly that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文