Re: UploadereventArgs

  •  12-07-2011, 3:13 AM

    Re: UploadereventArgs

    Hi,
     
    The images are only saved in the temp folder. On btnSave click I only get the message 'select images'. The code is copied from the example. Am I overlooking something?
     
    ASPX Code:
     
    1. <asp:UpdatePanel ID="udpImages" runat="server" UpdateMode="Conditional">  
    2.                         <ContentTemplate>  
    3.                             <cc2:UploadAttachments ID="uplImages" OnFileUploaded="uplImages_FileUploaded" runat="server"  
    4.                                 TempDirectory="~/Library/temp_upload" MaxFilesLimit="5" FileTooLargeMsg="Bestand is te groot! Max. 1 MB."  
    5.                                 MultipleFilesUpload="true" ShowProgressInfo="false" ShowProgressBar="false" InsertText="Kies uw afbeeldingen"  
    6.                                 MaxFilesLimitMsg="U mag maximaal 5 afbeeldingen uploaden" RemoveButtonText="Verwijder"  
    7.                                 ShowFileIcons="true">  
    8.                                 <ValidateOption MaxSizeKB="1000" AllowedFileExtensions="jpg,png,gif,jpeg,bmp" />  
    9.                             </cc2:UploadAttachments>  
    10.                         </ContentTemplate>  
    11.                     </asp:UpdatePanel>  
    12. <asp:Button runat="server" ID="btnSave" onclick="btnSave_Click" Text="Bewaren" OnClientClick="return submitbutton_click()" />  
     Javascript code:
     
    1. <script type="text/javascript">  
    2.   
    3.     function submitbutton_click() {  
    4.         var submitbutton = document.getElementById('<%=btnSave.ClientID %>');  
    5.         var uploadobj = document.getElementById('<%=uplImages.ClientID %>');  
    6.         if (!window.filesuploaded) {  
    7.             if (uploadobj.getqueuecount() > 0) {  
    8.   
    9.                 uploadobj.startupload();  
    10.             }  
    11.             else {  
    12.                 var uploadedcount = parseInt(submitbutton.getAttribute("itemcount")) || 0;  
    13.                 if (uploadedcount > 0) {  
    14.                     return true;  
    15.                 }  
    16.                 alert("Select images");  
    17.             }  
    18.             return false;  
    19.         }  
    20.         window.filesuploaded = false;  
    21.         return true;  
    22.     }  
    23.   
    24.       
    25. </script>  
    C# code:
     
    1. int uploadcount = 0;  
    2.   
    3.     protected override void OnPreRender(EventArgs e)  
    4.     {  
    5.         btnSave.Attributes["itemcount"] = uplImages.Items.Count.ToString();  
    6.   
    7.         base.OnPreRender(e);  
    8.     }  
    9.   
    10. public void uplImages_FileUploaded(object sender, UploaderEventArgs args)  
    11.     {  
    12.   
    13.         uploadcount++;  
    14.         Uploader uploader = (Uploader)sender;  
    15.         /*args.CopyTo("~/Library/nieuws/" + args.FileName);*/  
    16.           
    17.           
    18.     }  
    19.   
    20. public void btnSave_Click(object sender, EventArgs e)  
    21.     {  
    22.     }  
     
View Complete Thread