I want to fire the AsnyncFileUpload control through another control in the page.
I have used AsyncfileUpload from ASP.NET AJAX toolkit and hidden it through JQuery. And places a button next to it. When even i click this button and select a file i want to fire the AsycnFileUpload and upload files.
I have written most of the code but i get an Javascript error when i select a file.
(ERROR: Access Denied;
PLACE: setTimeout(function () {
mainForm.submit(); //Error here;
uploader._waitTimer = setTimeout(function () { uploader._wait() }, 100);
}, 0);
<asp:Button ID="btnFileUpload" runat="server" Text="Add" onclientclick="FileUploadClick(); return false;"/>
<ajaxToolkit:AsyncFileUpload runat="server" ID="AsyncFileUpload1" Width="400px" UploaderStyle="Modern" UploadingBackColor="#CCFFFF"/>
And this is my Javascript (I saw the markup generated by the control and got the File input type by appending "_ct102")
function FileUploadClick() {
var fileUploadControl = document.getElementById('<%= AsyncFileUpload1.ClientID %>' + '_ctl02')
fileUploadControl.click();
//fileUploadControl.setActive();
}