protected void UploadClicked(object sender, EventArgs e)
{
if (fileUpload.FileName != string.Empty)
{
try
{
string filename = Path.GetFileName(fileUpload.FileName);
if (fileUpload.FileName.ToUpper().EndsWith(".GPX"))
{
FilePath = Server.MapPath("~/Uploads/") + filename;
fileUpload.SaveAs(FilePath);
lblStatus.Text = "Upload status: File uploaded!";
BindFiles();
}
else
{
lblStatus.Text = "Upload status: Only .gpx files are accepted.";
}
}
catch (Exception ex)
{
lblStatus.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
}
}
else
{
lblStatus.Text = "Upload status: No file selected";
}
}