在AJAX updatepanel中上传的文件,没有完整的回发

时间:2021-10-31 15:05:46

I have a update panel, in the update panel I have fileupload control and button control, On button click, I need the file that I have upload in the fileupload control in updatepanel.

我有一个更新面板,在更新面板中我有fileupload控件和button控件,按下按钮,我需要我在updatepanel的fileupload控件中上传的文件。

Exact scenario, I have 8 tabs on page, each tab contains too much information, One of the tab is Attachment, when user click on Add New Attachment Modal Popup shown, Modal contains detailsview in Updatepanel and in the detailsview I have fileupload control, when user hit save button, detailsview inserting event fired, In the inserting event I need the file that I have upload.
Please Note, My page is heavy and I don't want full postBack.

确切的场景中,我有8页标签,每个标签包含太多的信息,其中一个选项卡是依恋,当用户点击添加新的附件模态弹出显示,模态包含detailsview Updatepanel和detailsview fileupload控件,当用户点击保存按钮,detailsview插入事件触发,在插入事件我需要的文件我已经上传。请注意,我的页面很重,我不想要完整的回邮。


Does anyone have solution of this issue?

有人能解决这个问题吗?

Advance thanks for your kind help.....

预先感谢您的帮助……

6 个解决方案

#1


36  

For solve this problem, Please see the following step.

要解决这个问题,请参见以下步骤。

  1. Add ajax-upload to your detail view.
    • iframe-based uploader like Resource#1.
    • iframe-based上传资源# 1。
    • Silverlight-based & Flash-based uploader. I like this technique because it doesn't require any server-side script for display current upload status. But in HTML5, you can create this without using any web browser plug-in.
    • Silverlight-based &基于flash的上传。我喜欢这种技术,因为它不需要任何服务器端脚本来显示当前的上传状态。但是在HTML5中,您可以不使用任何web浏览器插件就创建它。
    • Commercial uploader like Resource#2. that use hidden iframe for uploading.
    • 商业上传资源# 2。使用隐藏的iframe进行上传。
  2. 添加ajax-上载到您的详细视图。iframe-based上传资源# 1。Silverlight-based &基于flash的上传。我喜欢这种技术,因为它不需要任何服务器端脚本来显示当前的上传状态。但是在HTML5中,您可以不使用任何web浏览器插件就创建它。商业上传资源# 2。使用隐藏的iframe进行上传。
  3. Upload file to temporary location.

    上传文件到临时位置。

    • System response the temporary location. Next, client keep temporary location in hidden input in detail form.
    • 系统响应临时位置。接下来,客户端将临时位置以详细形式隐藏在隐藏的输入中。
    • Keep temporary location with session_id. You can store it in database or Session variable depend on your framework.
    • 使用session_id保持临时位置。可以根据框架将其存储在数据库或会话变量中。
  4. When you click on the save button, the system will move the files to their real location

    当您单击save按钮时,系统将把文件移动到它们的实际位置

Note. System will automatically delete the expired file from the temporary location.

请注意。系统将自动从临时位置删除过期的文件。

Resource

资源

  1. ASP.NET File Upload with Real-Time Progress Bar
  2. ASP。NET文件上载实时进度条。
  3. ASP.NET File Upload like GMail (Commercial)
  4. ASP。像GMail这样的网络文件上传(商业)

Update

更新

After almost one year, I just found a great 3rd-parties control for this question. This is an open source plug-in of jQuery. It name Plupload that allows you to upload files using HTML5, Silverlight, Flash or normal forms and it provide some unique features such as upload progress, image resizing and chunked uploads.

将近一年后,我发现了一个伟大的第三方控制这个问题。这是jQuery的一个开源插件。它名为Plupload,允许你上传文件使用HTML5, Silverlight, Flash或正常的形式,它提供一些独特的功能,如上传进度,图像大小和分块上传。

You can try & test Plupload by click here.

您可以通过点击这里来尝试和测试Plupload。

#2


4  

Can't be done without co-operating binaries being installed on the client. There is no safe mechanism for an AJAX framework to read the contents of a file and therefore be able to send it to the server. The browser supports that only as a multipart form post from a file input box.

如果没有在客户端上安装共同操作的二进制文件,就不能这样做。AJAX框架没有安全的机制来读取文件的内容,因此无法将其发送到服务器。浏览器只支持作为来自文件输入框的多部分表单post。

#3


1  

The problem is with the way the HTML file upload control works, has nothing to do with ASP.net, for the file upload control to work you need a full post of the form data. You can only simulate that your are not doing a full postback, by doing all the operation in a hidden iframe that does the actual uploading

问题是HTML文件上传控件的工作方式,与ASP.net没有任何关系,要让文件上传控件工作,您需要完整地发布表单数据。您只能通过在做实际上传的隐藏iframe中执行所有操作来模拟您的回发过程

#4


0  

The sites you see that do provide this functionality generally use flash or an iframe so that the postback occurs in the iframe and gives the illusion of an ajax request.

提供此功能的站点通常使用flash或iframe,以便回发发生在iframe中,并产生ajax请求的错觉。

HTH

HTH

OneSHOT

一次通过

#5


0  

I've tried swfupload (http://swfupload.org/), but do keep in mind that you have to jump through hoops if you're using forms authentication with non-IE browsers. This is apparently a flash bug, and it's not fixed in flash 10. I decided against using it in our framework because of this bug, but it was otherwise a great product.

我已经尝试过swfupload (http://swfupload.org/),但是请记住,如果您在非ie浏览器中使用表单身份验证,那么您必须跳过这些限制。这显然是一个flash bug,并不是在flash 10中固定的。由于这个bug,我决定不在我们的框架中使用它,但除此之外,它是一个很棒的产品。

#6


0  

I recommend the uploader widget from YUI. See http://developer.yahoo.com/yui/uploader/

我推荐YUI的uploader小部件。参见http://developer.yahoo.com/yui/uploader/

I think you could use it to accomplish your goal. Your javascript would need to fetch the file back down to the client from the server after it completed its upload. But the page would not refresh--the upload is through flash and a hidden iframe. The download to show the file's contents to the user would be via ajax.

我认为你可以用它来实现你的目标。在服务器完成上传之后,javascript将需要从服务器将文件取回到客户机。但页面不会刷新——上传是通过flash和一个隐藏的iframe完成的。向用户显示文件内容的下载将通过ajax。

If the user does not "approve" the upload, then simply make another ajax call to the server to delete the file.

如果用户不“批准”上传,那么只需向服务器发出另一个ajax调用来删除文件。

#1


36  

For solve this problem, Please see the following step.

要解决这个问题,请参见以下步骤。

  1. Add ajax-upload to your detail view.
    • iframe-based uploader like Resource#1.
    • iframe-based上传资源# 1。
    • Silverlight-based & Flash-based uploader. I like this technique because it doesn't require any server-side script for display current upload status. But in HTML5, you can create this without using any web browser plug-in.
    • Silverlight-based &基于flash的上传。我喜欢这种技术,因为它不需要任何服务器端脚本来显示当前的上传状态。但是在HTML5中,您可以不使用任何web浏览器插件就创建它。
    • Commercial uploader like Resource#2. that use hidden iframe for uploading.
    • 商业上传资源# 2。使用隐藏的iframe进行上传。
  2. 添加ajax-上载到您的详细视图。iframe-based上传资源# 1。Silverlight-based &基于flash的上传。我喜欢这种技术,因为它不需要任何服务器端脚本来显示当前的上传状态。但是在HTML5中,您可以不使用任何web浏览器插件就创建它。商业上传资源# 2。使用隐藏的iframe进行上传。
  3. Upload file to temporary location.

    上传文件到临时位置。

    • System response the temporary location. Next, client keep temporary location in hidden input in detail form.
    • 系统响应临时位置。接下来,客户端将临时位置以详细形式隐藏在隐藏的输入中。
    • Keep temporary location with session_id. You can store it in database or Session variable depend on your framework.
    • 使用session_id保持临时位置。可以根据框架将其存储在数据库或会话变量中。
  4. When you click on the save button, the system will move the files to their real location

    当您单击save按钮时,系统将把文件移动到它们的实际位置

Note. System will automatically delete the expired file from the temporary location.

请注意。系统将自动从临时位置删除过期的文件。

Resource

资源

  1. ASP.NET File Upload with Real-Time Progress Bar
  2. ASP。NET文件上载实时进度条。
  3. ASP.NET File Upload like GMail (Commercial)
  4. ASP。像GMail这样的网络文件上传(商业)

Update

更新

After almost one year, I just found a great 3rd-parties control for this question. This is an open source plug-in of jQuery. It name Plupload that allows you to upload files using HTML5, Silverlight, Flash or normal forms and it provide some unique features such as upload progress, image resizing and chunked uploads.

将近一年后,我发现了一个伟大的第三方控制这个问题。这是jQuery的一个开源插件。它名为Plupload,允许你上传文件使用HTML5, Silverlight, Flash或正常的形式,它提供一些独特的功能,如上传进度,图像大小和分块上传。

You can try & test Plupload by click here.

您可以通过点击这里来尝试和测试Plupload。

#2


4  

Can't be done without co-operating binaries being installed on the client. There is no safe mechanism for an AJAX framework to read the contents of a file and therefore be able to send it to the server. The browser supports that only as a multipart form post from a file input box.

如果没有在客户端上安装共同操作的二进制文件,就不能这样做。AJAX框架没有安全的机制来读取文件的内容,因此无法将其发送到服务器。浏览器只支持作为来自文件输入框的多部分表单post。

#3


1  

The problem is with the way the HTML file upload control works, has nothing to do with ASP.net, for the file upload control to work you need a full post of the form data. You can only simulate that your are not doing a full postback, by doing all the operation in a hidden iframe that does the actual uploading

问题是HTML文件上传控件的工作方式,与ASP.net没有任何关系,要让文件上传控件工作,您需要完整地发布表单数据。您只能通过在做实际上传的隐藏iframe中执行所有操作来模拟您的回发过程

#4


0  

The sites you see that do provide this functionality generally use flash or an iframe so that the postback occurs in the iframe and gives the illusion of an ajax request.

提供此功能的站点通常使用flash或iframe,以便回发发生在iframe中,并产生ajax请求的错觉。

HTH

HTH

OneSHOT

一次通过

#5


0  

I've tried swfupload (http://swfupload.org/), but do keep in mind that you have to jump through hoops if you're using forms authentication with non-IE browsers. This is apparently a flash bug, and it's not fixed in flash 10. I decided against using it in our framework because of this bug, but it was otherwise a great product.

我已经尝试过swfupload (http://swfupload.org/),但是请记住,如果您在非ie浏览器中使用表单身份验证,那么您必须跳过这些限制。这显然是一个flash bug,并不是在flash 10中固定的。由于这个bug,我决定不在我们的框架中使用它,但除此之外,它是一个很棒的产品。

#6


0  

I recommend the uploader widget from YUI. See http://developer.yahoo.com/yui/uploader/

我推荐YUI的uploader小部件。参见http://developer.yahoo.com/yui/uploader/

I think you could use it to accomplish your goal. Your javascript would need to fetch the file back down to the client from the server after it completed its upload. But the page would not refresh--the upload is through flash and a hidden iframe. The download to show the file's contents to the user would be via ajax.

我认为你可以用它来实现你的目标。在服务器完成上传之后,javascript将需要从服务器将文件取回到客户机。但页面不会刷新——上传是通过flash和一个隐藏的iframe完成的。向用户显示文件内容的下载将通过ajax。

If the user does not "approve" the upload, then simply make another ajax call to the server to delete the file.

如果用户不“批准”上传,那么只需向服务器发出另一个ajax调用来删除文件。