I'm using a FileUpload control in ASP.net. Formatting input buttons is such a pain that I'm trying to work around by using a simple (formatted) button to activate a jQuery function that clicks the FileUpload control. Here is my formatted button, called btn_upload_FILE:
<asp:Button ID="btn_upload_FILE" runat="server" class="c_button" Text="Import an EDD" OnClick="Main" />
Here's the FileUpload control:
<asp:FileUpload runat="server" ID="FILE_uploader"></asp:FileUpload>
And here's the jQuery:
$('#<%= btn_upload_FILE.ClientID %>').click(function () {
$('#<%= FILE_uploader.ClientID %>').click();
});
Super-simple, and it works great, it opens a file browser and lets me select a file.
The problem is that, even through the FileUpload control appears to be working, the file I select isn't actually loaded into the FileUpload control, so my code-behind can't see it. It looks like it's working, but the FileUpload ends up empty. The FileUpload's .change event is not fired, so I know nothing is happening. If I just press the FileUpload control's button, it works fine.
Can anyone tell me why the FileUpload isn't receiving a file, even though I can browse with it? Any help is, as always, appreciated.