The HasFile property gets a value that indicates whether the FileUpload control contains the file to upload. Use this property to verify that the file exists before performing an operation on the file to be uploaded. For example, use the HasFile property to verify that a file exists before calling the SaveAs method to save the file to disk. If HasFile returns True, the SaveAs method is invoked. If it returns false, a message is displayed to the user indicating that the control does not contain a file.
The solution is as follows:
Programme I,
If you set the ScriptManager enablepartialrending to False, you can upload it correctly, this method is the simplest, but there will be a flaw, that is, multiple UpdatePanel on the same page cannot be refreshed alone.
In addition, when there is validator in your UpdatePanel, it can cause the whole page to postback, which seems to be a bug in Altas.
Programme II,
1. Use UpdatePanel in the main page, then UpdatePanel inside not fileupload control, but an IFRAME
2: This iframe is linked to a new page with a FileUpload control on that page.
3: After uploading, tell the home page to upload the results
Direct use of FileUpload example: In this example, the server can not find uploaded files.
<atlas:updatepanel id= "Up1" mode= "Conditional" runat= "Server" >
<ContentTemplate>
<asp:fileupload id= "FileUpload1" runat= "Server"/>
<asp:button id= "Button1" runat= "Server" text= "button" onclick= "Button1_Click"/>
<ContentTemplate>
<atlas:UpdatePanel>
1. Create a new home page default.aspx in the appropriate location, place an upload attachment UpdatePanel area
<atlas:updatepanel id= "up_attachment" mode= "Conditional" runat= "Server" >
<ContentTemplate>
<iframe id= "File" name= "file" src= "attachment.aspx" ><iframe>
<ContentTemplate>
<atlas:UpdatePanel>
2: New Upload File page attachment.aspx, then put the FileUpload control
<div>
<asp:fileupload id= "FileUpload1" runat= "Server"/>
<asp:button id= "Button1" runat= "Server" text= "OK" onclick= "Button1_Click"/>
<div>
3: Inside the attachment.aspx, upload files after the Call home page JS, report upload situation. This is the function prototype:
<script> Window.top.callBack (fileName); <script>
4:default.aspx The home page adds this function, processing the return value
<script>
function CallBack (fileName)
{document.getElementById (' Attach1 '). Innerhtml=filename}
<script>