问题描述
我有一个更新面板,在更新面板中有文件上传控件和按钮控件,单击按钮时,我需要在更新面板的文件上传控件中上传的文件.
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.
确切的场景,我在页面上有 8 个选项卡,每个选项卡包含太多信息,其中一个选项卡是附件,当用户单击显示的添加新附件模态弹出窗口时,模态包含更新面板中的详细信息视图,在详细信息视图中我有文件上传控件,当用户点击保存按钮时,detailsview插入事件被触发,在插入事件中我需要我上传的文件.
请注意,我的页面很重,我不想完整回传.
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.
有没有人解决过这个问题?
Does anyone have solution of this issue?
预先感谢您的帮助.....
Advance thanks for your kind help.....
推荐答案
解决这个问题,请看下面的步骤.
For solve this problem, Please see the following step.
- 将 ajax-upload 添加到您的详细信息视图中.
- 基于 iframe 的上传器,例如 Resource#1.
- 基于 Silverlight 的 &基于 Flash 的上传器. 我喜欢这种技术,因为它不需要任何服务器端脚本来显示当前的上传状态.但是在 HTML5 中,您可以在不使用任何网络浏览器插件的情况下创建它.
- 像 Resource#2 这样的商业上传器.使用隐藏的 iframe 进行上传.
- Add ajax-upload to your detail view.
- iframe-based uploader like Resource#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.
- Commercial uploader like Resource#2. that use hidden iframe for uploading.
将文件上传到临时位置.
- 系统响应临时位置.接下来,客户端将临时位置保存在详细表单的隐藏输入中.
- 使用 session_id 保留临时位置.您可以将其存储在数据库或会话变量中,具体取决于您的框架.
- 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.
当您点击保存按钮时,系统会将文件移动到它们的实际位置
When you click on the save button, the system will move the files to their real location
注意.系统会自动从临时位置删除过期文件.
Note. System will automatically delete the expired file from the temporary location.
资源
更新
将近一年后,我刚刚找到了一个很好的 3rd-party 控件来解决这个问题.这是一个开源的jQuery插件.它命名为 Plupload,允许您使用 HTML5、Silverlight、Flash 或普通形式上传文件,并提供一些独特的功能,例如上传进度、图像大小调整和分块上传.
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.
这篇关于在没有完整回发的 AJAX 更新面板中上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!