Reputation: 569
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?
Upvotes: 3
Views: 1840
Reputation: 630459
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:
$("#myDiv").dialog({ ...options... }).parent().appendTo("form:first");
Now that it's been moved inside the <form>
, it should post correctly.
Upvotes: 5