[CLOSED] fileupload question

  1. #1

    [CLOSED] fileupload question

    Hi

    I am calling/using Fileupload control in usercontrol hosted in a window called from aspx page. I am following example from examples web site.

    in the the UploadClick event I have the following

    if (this.FileUploadField1.HasFile)
    {
        string fileName = System.IO.Path.GetFileName(this.FileUploadField1.PostedFile.FileName);
        string folderName = IFG.Common.GetDocumentArchiveMapPath(ProgramYear);
        try
        {
            if (!Directory.Exists(folderName))
            {
                Directory.CreateDirectory(folderName);
            }
            //if (File.Exists(pathToTestFile)) File.Delete(pathToTestFile);
            fileName = System.IO.Path.Combine(folderName, fileName);
            this.FileUploadField1.PostedFile.SaveAs(fileName);
            this.lblMsg.Hidden = false;
            this.lblMsg.Text = string.Format(tpl, System.IO.Path.GetFileName(this.FileUploadField1.PostedFile.FileName), "Successfully");
    
            Ext.Msg.Show(new MessageBox.Config
            {
                Buttons = MessageBox.Button.OK,
                Icon = MessageBox.Icon.INFO,
                Title = "Success",
                Message = string.Format(tpl, System.IO.Path.GetFileName(this.FileUploadField1.PostedFile.FileName))
            });
        }
        catch (UnauthorizedAccessException ex)
        {
            Ext.Msg.Show(new MessageBox.Config
            {
                Buttons = MessageBox.Button.OK,
                Icon = MessageBox.Icon.ERROR,
                Title = "Permission Error",
                Message = ex.Message + "Permission to upload file denied"
            });
        }
        catch (Exception ee)
        {
            Ext.Msg.Show(new MessageBox.Config
            {
                Buttons = MessageBox.Button.OK,
                Icon = MessageBox.Icon.ERROR,
                Title = "General Error",
                Message = ee.Message
            });
        }
    }
    else
    {
        Ext.Msg.Show(new MessageBox.Config
        {
            Buttons = MessageBox.Button.OK,
            Icon = MessageBox.Icon.ERROR,
            Title = "Fail",
            Message = "No file uploaded"
        });
    }


    if I remove the following code

    Ext.Msg.Show(new MessageBox.Config
    {
        Buttons = MessageBox.Button.OK,
        Icon = MessageBox.Icon.INFO,
        Title = "Success",
        Message = string.Format(tpl, System.IO.Path.GetFileName(this.FileUploadField1.PostedFile.FileName))
    });
    then the progress bar does not go away even though it has succesfully completed the upload

    this is the button definition

    <ext:Button ID="SaveButton" runat="server" Text="Save">
        <AjaxEvents>
            <Click
                OnEvent="UploadClick"
                Before=" if(!#{BasicForm}.getForm().isValid()) { return false; }
                Ext.Msg.wait('Uploading your &#100;ocument...', 'Uploading');"
                Success="return true;"
                Failure="Ext.Msg.show({
                title : 'Error',
                msg : 'Error during uploading',
                minWidth: 200,
                modal : true,
                icon : Ext.Msg.ERROR,
                buttons : Ext.Msg.OK
                });">
            </Click>
        </AjaxEvents>
    </ext:Button>
    I have tried adding a Success="return true;" but it does not help. How can I tell the program bar that the upload is done.

    thanks

    idriss
  2. #2

    RE: [CLOSED] fileupload question

    Hi,

    You must hide waiting dialog manually. For example, call Ext.Msg.Hide()
    Please note that any other call of Ext.Msg.Show will hide previous Ext.Msg dialog (therefore when you call Ext.Msg.Show when success upload then waiting dialog was hid)

  3. #3

    RE: [CLOSED] fileupload question

    vlad

    Thank you. I understand. please mark as solved.
    idriss

Similar Threads

  1. [CLOSED] [MVC] FileUpload in MVC
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 27, 2015, 4:03 PM
  2. [CLOSED] [#92] FileUpload
    By Timothy in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: Jan 16, 2013, 3:44 AM
  3. [CLOSED] Please help me with a fileupload question
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Oct 15, 2012, 6:41 AM
  4. [CLOSED] [1.0] Please help me with fileupload filepath
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 10, 2010, 2:33 PM
  5. bug in fileupload
    By pablisho in forum 1.x Help
    Replies: 0
    Last Post: Jul 01, 2009, 10:55 AM

Posting Permissions