Sep 02, 2009, 4:27 AM
[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 I remove the following code
this is the button definition
thanks
idriss
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 uploadthis 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 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