[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
Code:
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
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
Code:
<ext:Button ID="SaveButton" runat="server" Text="Save">
<AjaxEvents>
<Click
OnEvent="UploadClick"
Before=" if(!#{BasicForm}.getForm().isValid()) { return false; }
Ext.Msg.wait('Uploading your document...', '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
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)
RE: [CLOSED] fileupload question
vlad
Thank you. I understand. please mark as solved.
idriss