文件上传不jQuery UI的对话框内工作 [英] File uploads not working within jQuery UI Dialog

查看:150
本文介绍了文件上传不jQuery UI的对话框内工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个相当奇怪的问题,我想看看是否有人有一些了解。

So I have a rather odd issue that I wanted to see if anyone has some insight into.

我有我显示已上传到我们的服务器的文件格的页面。网格中的工具栏为他们提供上载更多文件的能力。当他们点击工具栏上的添加文件按钮,会出现一个jQuery UI的对话模式窗口在它一个简单的文件上传控件。他们选择一个文件后,点击对话框中的上传按钮,提交基本形式上传。另外请注意,因为我使用asp.net,还有就是对网页,所以我不提交错误的表格上只有一种形式。

I have a page in which I display a grid of files that have been uploaded to our server. The toolbar for the grid provides them with the ability to upload more files. When they click the "Add File" button on the toolbar, a jQuery UI Dialog modal window appears with a simple file upload control in it. After they select a file, they click the "Upload" button on the Dialog which submits the underlying form for uploading. Also note that because I'm using asp.net, there is only one form on the page so I'm not submitting the wrong form.

现在...当我试图寻找在后台上传的文件,没有文件被上传。更糟的是,如果我将上传出的控制对话框股利并从页面中直接使用它没有一个对话框,在上传做工精细。

Now... when I attempt to look for uploaded files on the backend, no files are uploaded. What's worse, if I move the upload control out of the dialog div and use it straight from the page without a dialog, the uploads work fine.

这使我相信,即使我定义的股利将在主模内成为我的对话框,允许它可以用一个回发提出,jQuery是莫名其妙地移动它还是从形式取消关联吧。

This leads me to believe that even though I am defining the div that will become my dialog within the main form to allow it to submit with a postback, jQuery is somehow moving it or disassociating it from the form.

这可能吗?还是有别的东西,我可能会丢失?我似乎无法找到,说两种方式的任何文件。在此先感谢!

Is this possible? Or is there something else I may be missing? I can't seem to find any documentation that says either way. Thanks in advance!

推荐答案

您说得对。对话框移动其内容的形式之外,并追加到身体。可能获得对DOM的更好的控制,以确保它始终显示在中央,高于一切,并且不包含在某个绝对定位的DIV左右...

You're right. Dialog moves its content outside of its form, and appends it to body. Probably to gain better control of the DOM, to make sure it always displays in the center, above everything else, and is not contained in some absolutely positioned DIV or so...

这篇关于文件上传不jQuery UI的对话框内工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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