manual upload in code behind

Last post 10-11-2011, 10:35 AM by Kenneth. 2 replies.
Sort Posts: Previous Next
  •  10-10-2011, 8:45 AM 70332

    manual upload in code behind

    Hi all,
     
     How do I get the list of files if I want to make the upload with an separate button with code behind?
     
    The Upload funtion need three parameter but I only have got the last one:
     
            If myControl.NumFilesShowQueueUI > 0 Then

                myControl.Upload([filesize], [filename], [temppath])

            End If 
     
     I have this data on the event Uploader_FileUploaded in "ByVal args As UploaderEventArgs" but not at the manual upload.
     
    Thanks.
  •  10-11-2011, 7:34 AM 70339 in reply to 70332

    Re: manual upload in code behind

    nobody an idea?
  •  10-11-2011, 10:35 AM 70343 in reply to 70339

    Re: manual upload in code behind

    Hi jerrysax,
     
    please try the example below, it shows you how to get the upload files data by a button
     
    <%@ Page Language="VB" %>

    <%@ Register Assembly="CuteWebUI.AjaxUploader" Namespace="CuteWebUI" TagPrefix="CuteWebUI" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">
       
        Protected Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            For i As Integer = 0 To uploader1.Items.Count - 1
                label1.Text += "File Name: " + uploader1.Items(i).FileName
                label1.Text += "<br />"
                label1.Text += "File Szie: " + uploader1.Items(i).FileSize.ToString()
                label1.Text += "<br />"
            Next

        End Sub
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <CuteWebUI:UploadAttachments ID="uploader1" runat="server">
                </CuteWebUI:UploadAttachments>
                <asp:Button ID="button1" runat="server" Text="get upload files" OnClick="button1_Click" /><br />
                <asp:Label ID="label1" runat="server"></asp:Label>
            </div>
        </form>
    </body>
    </html>
     
    Regards,
     
    Ken
View as RSS news feed in XML