How to get the photos selected using ajax multiple upload in code behind

Last post 10-28-2009, 8:55 AM by cutechat. 5 replies.
Sort Posts: Previous Next
  •  10-22-2009, 4:15 AM 56586

    How to get the photos selected using ajax multiple upload in code behind

    Hi,

    I have purchased the Ajax multiple Uploader license recently. I am facing problems when I save the selected photos in my code behind.Please provide me the steps how to save in code behind.I am using .NET 2.0. Please Reply me ASAP
  •  10-23-2009, 8:21 AM 56631 in reply to 56586

    Re: How to get the photos selected using ajax multiple upload in code behind

    Hi,
     
    Please try this sample :
     
    1. <%@ Page Language="C#" %>  
    2.   
    3. <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    5.   
    6. <script runat="server">  
    7.   
    8.     protected void Uploader1_FileUploaded(object sender, UploaderEventArgs args)   
    9.     {   
    10.         string folder = Server.MapPath("Photos");   
    11.            
    12.         if (!System.IO.Directory.Exists(folder))   
    13.             System.IO.Directory.CreateDirectory(folder);   
    14.            
    15.         string filepath = System.IO.Path.Combine(folder, args.FileName);   
    16.            
    17.         if (System.IO.File.Exists(filepath))   
    18.             System.IO.File.Delete(filepath);   
    19.   
    20.         //note : must set AllowedFileExtensions to prevent the client upload any aspx code which may be executed !   
    21.         args.MoveTo(filepath);   
    22.   
    23.         Page.Title = "Uploaded : " + args.FileName;   
    24.         Link1.Visible = true;   
    25.         Link1.NavigateUrl = "Photos/" + args.FileName;   
    26.         Link1Link1.Text = Link1.NavigateUrl;   
    27.     }   
    28. </script>  
    29.   
    30. <html xmlns="http://www.w3.org/1999/xhtml">  
    31. <head runat="server">  
    32.     <title>Untitled Page</title>  
    33. </head>  
    34. <body>  
    35.     <form id="form1" runat="server">  
    36.         <CuteWebUI:Uploader runat="server" ID="Uploader1" OnFileUploaded="Uploader1_FileUploaded">  
    37.             <ValidateOption AllowedFileExtensions="*.jpg,*.gif,*.png" />  
    38.         </CuteWebUI:Uploader>  
    39.         <asp:HyperLink runat="server" ID="Link1" Target="_blank" Visible="false" />  
    40.     </form>  
    41. </body>  
    42. </html>  
     
    Regards,
    Terry
  •  10-26-2009, 4:49 AM 56662 in reply to 56631

    Re: How to get the photos selected using ajax multiple upload in code behind

    Hi,
     
    Thanks for your reply.
    I want to select multiple multiple photos and also I have to save those selected photos to a folder in root directory.Photos should be added in the root directory only when the user clicks on the Add button which is kept below the "CuteWebUI:UploadAttachments" tag.
     
    <CuteWebUI:UploadAttachments runat="server" ID="TopicFiles" OnFileUploaded="Uploader1_FileUploaded">
        <ValidateOption AllowedFileExtensions="jpeg,jpg,gif,zip,doc,pdf" MaxSizeKB="10240" />
        </CuteWebUI:UploadAttachments>
        <asp:Button ID="Button1" runat="server" OnClick="btnAdd1_Click" Text="Button" />
     
     
    Please help me in this
     
     Thanks,
    Jagan 
  •  10-26-2009, 2:52 PM 56684 in reply to 56662

    Re: How to get the photos selected using ajax multiple upload in code behind

    Jaganr012:
    Hi,
     
    Thanks for your reply.
    I want to select multiple multiple photos and also I have to save those selected photos to a folder in root directory.Photos should be added in the root directory only when the user clicks on the Add button which is kept below the "CuteWebUI:UploadAttachments" tag.
     
    <CuteWebUI:UploadAttachments runat="server" ID="TopicFiles" OnFileUploaded="Uploader1_FileUploaded">
        <ValidateOption AllowedFileExtensions="jpeg,jpg,gif,zip,doc,pdf" MaxSizeKB="10240" />
        </CuteWebUI:UploadAttachments>
        <asp:Button ID="Button1" runat="server" OnClick="btnAdd1_Click" Text="Button" />
     
     
    Please help me in this
     
     Thanks,
    Jagan 
     
    Try
     
    <CuteWebUI:UploadAttachments runat="server" ID="TopicFiles" InsertButtonID='Button1' OnFileUploaded="Uploader1_FileUploaded">
        <ValidateOption AllowedFileExtensions="jpeg,jpg,gif,zip,doc,pdf" MaxSizeKB="10240" />
        </CuteWebUI:UploadAttachments>
        <asp:Button ID="Button1" runat="server" OnClick="btnAdd1_Click" Text="Button" />
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  10-27-2009, 7:14 AM 56705 in reply to 56586

    Re: How to get the photos selected using ajax multiple upload in code behind

    Hi,
     
    Thanks for your help.
    Its working fine as expected.
    How to give colors for the table that shows selected files?
    I want to give color to the first row alone.
     
    Thanks,
    Jagan
  •  10-28-2009, 8:55 AM 56746 in reply to 56705

    Re: How to get the photos selected using ajax multiple upload in code behind

    Jagan,
     
    Please use the UploadAttachments.HeaderRowStyle
     
    Regards,
    Terry
View as RSS news feed in XML