简体   繁体   English

使用C#在ASP.NET中使用Ajax的FileUpload

[英]FileUpload Using Ajax In ASP.NET With C#

我需要使用FileUpload上传图像而不回发(使用Ajax)。我尝试了很多例子。但是在所有回发即将到来或者他们正在使用PHP。任何人都可以帮我在ASP.Net中使用ajax进行单文件上传或多文件上传用C#。

SWFUpload SWFUpload的

http://demo.swfupload.org/v220beta3/simpledemo/index.php http://demo.swfupload.org/v220beta3/simpledemo/index.php

http://swfupload.org/ http://swfupload.org/

Javascript and Flash, there's no post-back :) and there's .NET implementations available on the site. Javascript和Flash,没有post-back :)并且网站上有.NET实现。

As the others say you can't do it completely without a postback but you can add some nice ajax functionality around the process. 正如其他人所说,如果没有回发你就无法完成它,但你可以在整个过程中添加一些不错的ajax功能。 Steve Sanderson has written a good walkthrough here: 史蒂夫桑德森在这里写了一篇很好的演练:

http://blog.codeville.net/2008/11/24/jquery-ajax-uploader-plugin-with-progress-bar/ http://blog.codeville.net/2008/11/24/jquery-ajax-uploader-plugin-with-progress-bar/

我个人使用过这个: Ajax Uploader - 对你不自由,但相当不错。

I use Ajax Uploader too. 我也使用Ajax Uploader It works great for my projects and it allows you to upload files to web server without refreshing the page. 它适用于我的项目,它允许您上传文件到Web服务器而无需刷新页面。

Here is a demo page . 这是一个演示页面

正如其他人所说,文件上传需要回发。在任何更新面板中,你应该将文件上传控制注册为postbackcontrol到scriptmanager。同时你可能会看到telerik上传控件以了解它应该是什么。

There is no such thing as a ajax file upload. 没有ajax文件上传这样的东西。 The components that you see either use flash swfupload or a hidden iframe that they post a form to that give the impression it is happening in an ajax manner. 您看到的组件使用flash swfupload或他们发布表单的隐藏iframe,以给人以ajax方式发生的印象。 There are many plugins avaiable to help you do this. 有很多插件可以帮助你做到这一点。 My favourite is this that uses jquery and swfupload 我最喜欢的是这个使用jQuery和SWFUpload的

There is no way you can access the contents of a file input field through JS. 您无法通过JS访问文件输入字段的内容。 This is because of security concerns. 这是出于安全考虑。 Though what you CAN do is to create an iframe and from a button submit only that iframe which again can contain your file input field... 虽然你可以做的是创建一个iframe,然后从一个按钮只提交iframe,它再次包含你的文件输入字段......

This would give the "impression" of an Ajax File Upload control... 这将给出Ajax文件上传控件的“印象”......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM