Dec 19, 2011, 8:23 PM
Help with ext:FileUploadField getting incorrect path.
Hi,
I'm somewhat new to Ext.NET and I'm stuck on this FileUploadField control. I'm trying to upload a file from my desktop and when I try to get the full path of the file in order to ftp the file, it gives me the wrong file path. As a result, I get an error because it cannot find the file. For example, I try to upload a file from this location "C:\Users\username\Desktop\ftpTest.txt" and when I try print a message in the trace log with the File Path, it reads "c:\windows\system32\inetsrv\ftpTest.txt".
Here is some sample code to show you what I'm doing.
I'm somewhat new to Ext.NET and I'm stuck on this FileUploadField control. I'm trying to upload a file from my desktop and when I try to get the full path of the file in order to ftp the file, it gives me the wrong file path. As a result, I get an error because it cannot find the file. For example, I try to upload a file from this location "C:\Users\username\Desktop\ftpTest.txt" and when I try print a message in the trace log with the File Path, it reads "c:\windows\system32\inetsrv\ftpTest.txt".
Here is some sample code to show you what I'm doing.
<ext:Panel runat="server" Frame="true" Title="Select File" StyleSpec="margin-top:15px; width:313px">
<Items>
<ext:FileUploadField ID="uploadFile" runat="server" Width="300" AllowBlank="false" />
<ext:Button ID="Button1" runat="server" Text="Submit File" StyleSpec="margin-top:10px;">
<DirectEvents>
<Click OnEvent="btnSubmitFile_Click" />
</DirectEvents>
</ext:Button>
</Items>
</ext:Panel>
protected void btnSubmitFile_Click(object sender, DirectEventArgs e)
{
if (uploadFile.HasFile)
{
Trace.Warn(Path.GetFullPath(uploadFile.FileName));
}
else
{
X.Msg.Show(new MessageBoxConfig
{
Buttons = MessageBox.Button.OK,
Icon = MessageBox.Icon.ERROR,
Title = "Fail",
Message = "No file uploaded"
});
}
}