ASP.Net Ajax AsyncFileUpload control not firing se

2019-08-15 07:17发布

I am writing an application that requires a user to upload files to the server machine. All user interaction with the user is done via JQuery UI modal popups. I created a test page to see that the AsyncFileUpload control works, and everything works fine on it. I added the AsyncFileUpload to the webform that I need it on, in a modal popup, but for some reason the server side event is never fired. The only difference on this page from the test page is that I send a variable through on the querystring which I, on initial load of the page, store in the viewstate (so it isn't required on future postbacks). Any ideas?

Thanks

2条回答
时光不老,我们不散
2楼-- · 2019-08-15 07:57

When dealing with AsyncFileUpload Control's Event, store any data in Session state instead of viewstate.

查看更多
爷、活的狠高调
3楼-- · 2019-08-15 08:02

When you use AsyncFileUpload you must set the right params in the "form" tag, that is placed in your Page or MasterPage:

 <form id="form1" runat="server" enctype="multipart/form-data" method="post">

If you don't set the right enctype and method UploadedComplete will never fire, and you won't be able to get FileUpload.FileBytes since FileUpload.HasFile returns true only during UploadedComplete execution.

I suppose that you didn't set the correct enctype on your modal popup.

Besides, prevoius versions of AsyncFileUpload didn't work on Chrome. Actual version (4.1.50731.0) solved the problem.

查看更多
登录 后发表回答