posted on Monday, September 13, 2004 2:15 PM
by
andybritcliffe
__doPostBack
At work I was facing a problem of filtering .pdf documents when they are selected using a fileupload field. I chose to do this client side as I though it would be quicker and simpler, ha I was a little wrong on that count.
Basically I could access the file upload field fine and detect the file type, however due to security restrictions you cannot actually reset the value of the field. Ouch.
Fortunately a fileupload field clears its contents on a page refresh, so using the built in asp.net __doPostBack function I could force the page to refresh and clear the field if the user doesn't select a .pdf extension, bit of a hack but it works....phew.