Hi,

I am using VS-2005.
In my website I have used the html input control with type=file.

The problem is that when I place this control inside an 'UpdatePanel' the 'PostedFile' property becomes 'Nothing' on postback. So in order to get things working I have removed the 'UpdatePanel' and things are working fine.

However, I am interested to know what kind of workaround is required if I were to use an 'UpdatePanel'? In one of the threads at forums.asp.net I found that we need to set a 'PostBackHandler' for the update panel. I have no idea how to implement this. Does it refer to 'AsyncPostbackTrigger' or 'SyncPostBackTrigger'?

Can someone give an idea how to implement this?

This is a Major drawback of asp.net which is not capable of providing this piece of functionality.

search on google this is a legendary problem since 2005 came in..!

i.e the reason why ppl switch to Telerik Controls.

Hi Ashish,
I was able to resolve the issue.
I had to set the trigger to 'PostBackTrigger' instead of 'AsyncPostbackTrigger' inside the UpdatePanel for the 'Upload' button.

In general, you cannot upload files with Ajax. This is simply a limit of HTTP and browsers. The only way to upload files asynchronously are:

  1. By using a browser plug-in (like Silverlight)
  2. By using a hack that "secretly" POSTs the file (IFRAME)

This article well describes the common IFRAME workaround used to enable "async" file uploads in standards-based sites:

http://www.openjs.com/articles/ajax/ajax_file_upload/

If you prefer a tool, you can use things like RadAsyncUpload for ASP.NET to achieve the same effect with less manual code:

http://demos.telerik.com/aspnet-ajax/upload/examples/async/ajaxprocessing/defaultcs.aspx

Hope that helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.