Joma Rajab

Joma Rajab

  • NA
  • 110
  • 51.8k

how to make file upload works properly

Aug 2 2016 7:11 AM
I am using file upload with post back trigger  but when I attach file first time it is not accept unless attached again in the second time. In addition, without post back trigger it woks but uploading the whole page that why I tried to use trigger because without it the upload button stopped 
 
Please help
  1.  protected void Upload(object sender, EventArgs e)  
  2.     {  
  3.         if (FileUpload1.HasFile && ddlSelect.Text == "Document")  
  4.         {  
  5.              Code for  Uploading  file code   
  6. .  
  7. .  
  8. .  
  9. }  
  10.  else  
  11.         if (FileUpload2.HasFile && ddlSelect.Text == "Video")  
  12.         {  
  13.                     Code for Uploading video file    
  14. .  
  15. .  
  16. .              
  17. }  
  18. else  
  19.        // {  
  20.                                       // for both  
  21.             if(FileUpload1.HasFile && FileUpload2.HasFile && ddlSelect.Text == "Both")  
  22. .  
  23. .  
  24. .  
  25. .  
  26.              
  27.  {  
  28.   
  29.   
  30. }  
  31.   
  32. asp code for trigger   
  33.   
  34. </ContentTemplate>  
  35.                   <Triggers>  
  36.               <asp:PostBackTrigger ControlID="btnUpload" />  
  37.           </Triggers>  
  38.      </asp:UpdatePanel>   
 
 

Answers (1)