使用空的已发布文件集合上传 ASP.Net 文件
我有一个 ASP.NET 文件上传控件,它作为表单的一部分。文件上传控件位于内容页面上,而表单定义位于整个站点的母版页上。我已将 multipart/form-enc 添加到母版页上的表单中。
我使用 jQuery 提交表单,同时从 jQuery UI 显示一个对话框。
当我发布时,没有文件返回到服务器。文件上传控件没有文件,HttpFileCollection为空。我怎样才能找到发布的文件?
I have an ASP.NET file upload control which sits as part of a form. The file upload control is on the content page while the form definition is on a master page across the site. I've added multipart/form-enc to the form on the master page.
I'm using jQuery to submit the form as I show a dialog box from jQuery UI.
When I post, no file is returned to the server. The file upload control has no file and HttpFileCollection is empty. How can I find the posted file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
大多数对话框都会获取您的内容,将其包装起来,然后将结果放在页面中的
之前...这是 ASP.Net 中的一个问题,因为它位于
< 之外。 form>
,它需要位于内部才能包含在 POST 数据中。创建对话框时,让它在完成时附加到
现在它已移至
Most dialogs take your content, wrap it, and place the result just before
</body>
in the page...this is a problem in ASP.Net because that's outside the<form></form>
, it needs to be inside to be included in the POSTed data.When you create the dialog, make it append inside the
<form>
when it finishes instead of the<body>
, for example this is what you'd do with the jQuery UI dialog:Now that it's been moved inside the
<form>
, it should post correctly.