the selected file is uploaded thousand of times

Last post 05-01-2008, 10:46 AM by Adam. 1 replies.
Sort Posts: Previous Next
  •  04-29-2008, 5:39 PM 39904

    the selected file is uploaded thousand of times

    This is what my code looks like (.aspx control decleration) <cutewebui:uploadattachments runat="server" id="upload_attachments" />
     

    Protected Overloads Overrides Sub OnInit(ByVal e As System.EventArgs)

    MyBase.OnInit(e)

    AddHandler upload_attachments.FileUploaded, AddressOf upload_attachments_file_uploaded

    End Sub

    Private Sub upload_attachments_file_uploaded(ByVal sender As Object, ByVal args As CuteWebUI.UploaderEventArgs)

    Dim stream As System.IO.Stream = args.OpenStream()

    Try

    upload_attachments.Upload(args.FileSize, args.FileName, stream)

    args.CopyTo("~/kb/article/" + Context.Request.QueryString("id"))

    Finally

    stream.Close()

    End Try

    End Sub

    Now the problem is that the file is uploaded over and over (4,000+) until i click stop on the browser, what am i doing wrong? all I want to do is once the file is uploaded to be copied over to the ~/kb/article/######/ directory.
     
    aslo the name of the file is in the GUID.filename.resx format, how can I make sure it keeps it's original name once its moved over to its proper directory.
     
    thank you for your time looking fordward to the solution.
     
  •  05-01-2008, 10:46 AM 39941 in reply to 39904

    Re: the selected file is uploaded thousand of times

    You have two issues.
     
    1. the problem is that the file is uploaded over and over (4,000+) until i click stop on the browser, what am i doing wrong?
     
    upload_attachments.Upload(args.FileSize, args.FileName, stream)
    args.CopyTo("~/kb/article/" + Context.Request.QueryString("id"))
     
    Should be changed to:
     

    upload_attachments.Upload(args.FileSize, args.FileName, stream)
    args.CopyTo("~/kb/article/" + Context.Request.QueryString("id"))

    2. aslo the name of the file is in the GUID.filename.resx format
     
    Why are you using the following code? Are you trying to rename the file while uploading?
     
    args.CopyTo("~/kb/article/" + Context.Request.QueryString("id"))
     

    The correct syntax should be:
     
    args.CopyTo("~/kb/article/" + args.FileName)
     
    Hope it helps.
     
    Keep me posted
     
     

    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

View as RSS news feed in XML