Ajax file uploader for large files not working fine

Last post 01-16-2009, 10:13 AM by Adam. 12 replies.
Sort Posts: Previous Next
  •  01-15-2009, 7:17 AM 47767

    Ajax file uploader for large files not working fine

    Hi everybody,
    I am using Ajax file uploader to upload large files,it uploads smoothly to a temp location but i didn't understand how can i save the file to my desired location,i found CopyTo() method but its not working idont know why.
    i am posting the code i have used:
     
    protected void FileUpload(object sender, UploaderEventArgs e)

    {

    Uploader uploader = (Uploader)sender;

    string path = Server.MapPath("Uploads");

    e.CopyTo(path + "\\" + e.FileName);

    }

    protected void Button1_Click(object sender, EventArgs e)

    {

          Uploader1.FileUploaded+=new UploaderEventHandler(FileUpload);

    }
     
    may some errors happend in my code or else i am not getting...plz help
     
    also after uploading i am getting an HTTP error like this:
     
     
    what is this...any help regarding this will appreciated
     
    Thans in advance
  •  01-15-2009, 8:57 AM 47768 in reply to 47767

    Re: Ajax file uploader for large files not working fine

    Suvradeep,
     
    Do you have problems with the small size files?
     
    If not, please check the following article:
     
     

    IIS7 and large files

    By default in IIS 7 requestFiltering  has the MaxAllowedContentLength property enabled. It specifies, in bytes, the maximum length of the content in a request. The default is 30,000,000 (approximately 30 megabytes.) To change this value you must edit the following file:

    %windir%\System32\inetsrv\config\applicationHost.config.

    In the ApplicationHost.config file, locate the <requestLimits> node.

    Modify the following code.

    <requestLimits maxAllowedContentLength ="10000000" />

    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

  •  01-15-2009, 9:03 AM 47769 in reply to 47768

    Re: Ajax file uploader for large files not working fine

    for both small and large files i am getting this HTTP error,
    I have already made that changes u have mentioned...
  •  01-15-2009, 9:12 AM 47770 in reply to 47767

    Re: Ajax file uploader for large files not working fine

    Hi,
     
    Can you test
     
    e.MoveTo(path + "\\" + e.FileName);
     
    instead of
     
    e.CopyTo(path + "\\" + e.FileName);
     
    ??
     
    copy a large file would spend a lot of time.
     
    Regards,
    Terry
     
  •  01-15-2009, 9:20 AM 47771 in reply to 47770

    Re: Ajax file uploader for large files not working fine

    thanks for ur reply,
    CopyTo() method not taking lot of time
    i have already tested the MoveTo(),
    but isn't working...
    i have setted a breakpoint on the event handler that is not catching the event also
  •  01-15-2009, 9:40 AM 47775 in reply to 47771

    Re: Ajax file uploader for large files not working fine

    i have also tried with this code that found some where in this forum,also its not working:

    using System;

    using System.Data;

    using System.Configuration;

    using System.Collections;

    using System.Web;

    using System.Web.Security;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    using System.Web.UI.WebControls.WebParts;

    using System.Web.UI.HtmlControls;

    using CuteWebUI;

    public partial class Upload : System.Web.UI.Page

    {

    Button b2 = new Button();

    Uploader _uploader;

    protected override void OnLoad(EventArgs e)

    {

    _uploader = new Uploader();

    _uploader.ID = "MyUploader";

    _uploader.InsertText = "Select file";

    _uploader.ValidateOption.AllowedFileExtensions = ".mp3,.MP3,.wav,.WAV";

    _uploader.TempDirectory = "Uploads";

    _uploader.FileUploaded += new UploaderEventHandler(_uploader_FileUploaded);

    Page.Form.Controls.Add(_uploader);

    base.OnLoad(e);

    }

    void _uploader_FileUploaded(object sender, UploaderEventArgs args)

    {

    string path = Server.MapPath("Uploads");

    //args.CopyTo(path + "\\" + args.FileName);

    args.MoveTo(path + "\\" + args.FileName);

    }

    }

  •  01-15-2009, 9:42 AM 47776 in reply to 47775

    Re: Ajax file uploader for large files not working fine

    Is this code is faulty?
    plz help
  •  01-15-2009, 9:49 AM 47779 in reply to 47776

    Re: Ajax file uploader for large files not working fine

    Can you try the following code and upload a small size file?
     
    <%@ Page language="c#"%>
    <%@ Register Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" TagPrefix="CuteWebUI" %>
    <html>
    <head>
    </head>
    <body>
        <form id="Form1" method="post" runat="server">
     <CuteWebUI:Uploader runat="server" MultipleFilesUpload="true" ID="Uploader1">
     </CuteWebUI:Uploader> 
        </form>
    </body>
    </html>
     
    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

  •  01-15-2009, 9:49 AM 47780 in reply to 47767

    Re: Ajax file uploader for large files not working fine

    Hi,
     
    We just checked the http erro1 12031 occurs when the uploader try to validate the file.
     
    We need investigate on this issue and give you a response as soon as possible.
     
    Regards,
    Terry
  •  01-15-2009, 10:10 AM 47786 in reply to 47779

    Re: Ajax file uploader for large files not working fine

    Thanks for ur reply Adam,
    The snippet u have send me is working but it throws me a HTTP error,
    it saves the file to an autocreated temp folder...
     
    can  plz tell me what can b the cause of this,so i can try in my side,
    is my code is faulty or else...plz inform
  •  01-15-2009, 10:34 AM 47789 in reply to 47786

    Re: Ajax file uploader for large files not working fine

  •  01-16-2009, 3:21 AM 47802 in reply to 47789

    Re: Ajax file uploader for large files not working fine

    Thanks Adam for replying,
    The files have send me still not works.
    I am summerizing the problems that i am facing,

    1>I cannot save the uploaded file to my desired location,though the file gets saved to a temp folder created by ur tool,i tried with CopyTo() and MoveTo() methods.

    2>If i set a breakpoint on
       void Uploader_FileUploaded(object sender, UploaderEventArgs args)

    the breakpoint is not catching the event so i cannot see the control flow also i cannot view the event working for me

    3>After upload compleates to a temp folder i am getting a weired messege something like "Http error1 1: 12031:Unknown"
    i've googled with this and i found i messege means:
     
    12031       ERROR_INTERNET_CONNECTION_RESET
                   The connection with the server has been reset.
    also found this may an error caused by updatepanel[not sure].

    plz let me know what is happening...

    Thanks

  •  01-16-2009, 10:13 AM 47813 in reply to 47802

    Re: Ajax file uploader for large files not working fine

    If you don't save the file will it work?
     
    Can you try the following code and upload a small size file?
     
    <%@ Page language="c#"%>
    <%@ Register Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" TagPrefix="CuteWebUI" %>
    <html>
    <head>
    </head>
    <body>
        <form id="Form1" method="post" runat="server">
     <CuteWebUI:Uploader runat="server" MultipleFilesUpload="true" ID="Uploader1">
     </CuteWebUI:Uploader> 
        </form>
    </body>
    </html>
     
    Can you try the following file?
     
     
     
    I need to figure out why the above code doesn't work for you fist then move on.
     
    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