File browser does not work

Last post 07-11-2013, 8:08 PM by gogetsome. 1 replies.
Sort Posts: Previous Next
  •  07-11-2013, 6:14 PM 77719

    File browser does not work

    Hello, with the attached code I'm attempting to upload mutliple files.

    When you click on the upload multiple files now button the file browse window does not open in order to select files to upload.

    What could be the cause?

     

    The bin folder of my solution conatains the ajaxuploader.lic and the cutewebui.ajaxuploader.dll

    Page

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

    <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head runat="server">

    <title></title>

    </head>

    <body>

    <form id="form1" runat="server">

    <div>

    <asp:ScriptManager runat="server" ID="scrm"></asp:ScriptManager>

    <asp:UpdatePanel runat="server" ID="UpdatePanel1">

    <ContentTemplate>

    <fieldset>

    <legend>Pictures</legend>

    <div id="pnlAddImage" runat="server">

    <CuteWebUI:UploadAttachments InsertText="Upload Multiple files Now" runat="server"

    ID="Attachments1" MultipleFilesUpload="true">

    <InsertButtonStyle />

    </CuteWebUI:UploadAttachments>

    <p>

    <asp:Button ID="ButtonDeleteAll" runat="server" Text="Delete All" />&nbsp;&nbsp;

    <asp:Button ID="ButtonTellme" runat="server" Text="Show Uploaded File Information" />

    </p>

    <p>

    Server Trace:<br />

    <asp:ListBox runat="server" ID="ListBoxEvents" />

    </p>

    </div>

    </fieldset>

    </ContentTemplate>

    </asp:UpdatePanel>

    </div>

    </form>

    </body>

    </html>

    Code Behind

    Imports CuteWebUI

    Partial Class _Default

    Inherits System.Web.UI.Page

    Public Sub InsertMsg(ByVal msg As String)

    ListBoxEvents.Items.Insert(0, msg)

    ListBoxEvents.SelectedIndex = 0

    End Sub

    Public Sub Attachments1_AttachmentAdded(ByVal sender As Object, ByVal args As AttachmentItemEventArgs)

    InsertMsg(args.Item.FileName + " has been uploaded.")

    End Sub

    Public Sub ButtonDeleteAll_Click(ByVal sender As Object, ByVal e As EventArgs)

    InsertMsg("Attachments1.DeleteAllAttachments();")

    Attachments1.DeleteAllAttachments()

    End Sub

    Public Sub ButtonTellme_Click(ByVal sender As Object, ByVal e As EventArgs)

    ListBoxEvents.Items.Clear()

    For Each item As AttachmentItem In Attachments1.Items

    InsertMsg(item.FileName & ", " & item.FileSize & " bytes.")

    'Copies the uploaded file to a new location.

    'item.CopyTo("c:\\temp\\"& args.FileName)

    'You can also open the uploaded file's data stream.

    'System.IO.Stream data = item.OpenStream()

    Next

    End Sub

    End Class

  •  07-11-2013, 8:08 PM 77721 in reply to 77719

    Re: File browser does not work

    Okay, after some research I found the cause. Disregard the posted code which is a scaled down version of my original code.

     

    My issue was that the uploader was on a panel that was hidded when the page was loaded by use of visible = false

     

    Can't do that... so I used:

     

    pnlPictures.Attributes.Add("style", "display:none")

    pnlPictures.Attributes.Add("style", "display:normal")

     

    When showing or hiding panels where the uploader is used.

     

View as RSS news feed in XML