Can I let to two upload button for each another the db field

Last post 02-23-2011, 9:26 PM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  02-21-2011, 7:37 PM 66340

    Can I let to two upload button for each another the db field

    Hello...
     
    I'm using Asp.net 4.0 MVC 3.
     
    One Form has multi upload button?
     
    like this;
     
     
    I tried it but I encounted the Sever Error message (500)
     
    Please let me the soulution...
     
    I'm sorry for my english.
     
    thanks
    GoonJae Lee
  •  02-23-2011, 9:26 PM 66406 in reply to 66340

    Re: Can I let to two upload button for each another the db field

    Hi m60dx,
     
    The example below shows you how to synchronize two uploader
     
    1. <%@ Page Language="C#" %>  
    2.   
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    4.   
    5. <script runat="server">  
    6.     protected void uploader1_FileUploaded(object sender, UploaderEventArgs args)  
    7.     {  
    8.         using (Stream str = args.OpenStream())  
    9.         {  
    10.             uploader2.Items.Add(args.FileSize, args.FileName, str);  
    11.         }  
    12.   
    13.     }  
    14.     protected void uploader1_AttachmentRemoveClicked(object sender, AttachmentItemEventArgs args)  
    15.     {  
    16.   
    17.         for (int i = uploader2.Items.Count - 1; i >= 0; i--)  
    18.         {  
    19.             if (uploader2.Items[i].FileName == args.Item.FileName)  
    20.             {  
    21.                 uploader2.Items[i].Remove();  
    22.             }  
    23.         }  
    24.     }  
    25.        
    26. </script>  
    27.   
    28. <html xmlns="http://www.w3.org/1999/xhtml">  
    29. <head runat="server">  
    30.     <title>Untitled Page</title>  
    31. </head>  
    32. <body>  
    33.     <form id="form1" runat="server">  
    34.         <div>  
    35.             <CuteWebUI:UploadAttachments ID="uploader1" runat="server" OnFileUploaded="uploader1_FileUploaded"  
    36.                 OnAttachmentRemoveClicked="uploader1_AttachmentRemoveClicked">  
    37.             </CuteWebUI:UploadAttachments>  
    38.             <CuteWebUI:UploadAttachments ID="uploader2" runat="server">  
    39.             </CuteWebUI:UploadAttachments>  
    40.         </div>  
    41.     </form>  
    42. </body>  
    43. </html> 
     
    Regards,
     
    ken
     
     
View as RSS news feed in XML