Re: How do I code for single file manual upload?

  •  02-15-2012, 11:36 AM

    Re: How do I code for single file manual upload?

    Hi dmathews,
     
    Try
     
    <%@ Page Language="C#" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">   
        protected void b1_Click(object sender, EventArgs e)
        {
            if (Uploader1.Items.Count != 0)
                label1.Text = Uploader1.Items[0].FileName;
        }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Start uploading manually</title>
    </head>
    <body>
        <form id="form1" runat="server">
         <asp:Label ID="label1" runat="server"></asp:Label><br />
            <CuteWebUI:UploadAttachments runat="server" ManualStartUpload="true" ID="Uploader1"
                InsertText="Browse Files (Max 1M)">
            </CuteWebUI:UploadAttachments>
            <br />
            <br />
            <asp:Button runat="server" ID="SubmitButton" OnClientClick="return submitbutton_click()"
                Text="Submit" /><br />
            <p>
                after you click on the submit button</p>
            <asp:Button ID="b1" runat="server" Text="get info after click the submit button"
                OnClick="b1_Click" /><br />
            <p>
                after you selected the file, before click on the submit button</p>
            <input type="button" value="get info before click the submit button" onclick="showFile()" /><br />
           
            <script type="text/javascript">
    var fileList;
    function submitbutton_click()
    {
    var submitbutton=document.getElementById('<%=SubmitButton.ClientID %>');
    var uploadobj=document.getElementById('<%=Uploader1.ClientID %>');
    if(!window.filesuploaded)
    {
    if(uploadobj.getqueuecount()>0)
    {
    uploadobj.startupload();
    }
    return false;
    }
    window.filesuploaded=false;
    return true;
    }
    function CuteWebUI_AjaxUploader_OnPostback()
    {
    window.filesuploaded=true;
    var submitbutton=document.getElementById('<%=SubmitButton.ClientID %>');
    submitbutton.click();
    return false;
    }
    function CuteWebUI_AjaxUploader_OnQueueUI(list)
        {
            fileList=list;
        }
        function showFile()
        {
            alert(fileList[0].FileName);
        }
            </script>
        </form>
    </body>
    </html>
     
    Regards,
     
    Ken 
View Complete Thread