This repository has been archived on 2023-12-31. You can view files and clone it, but cannot push or open issues or pull requests.
EDA263/lab3/cs_lab3/myWebApplication/Uploadfile.ascx.cs
2022-02-23 14:05:00 +01:00

44 lines
1.0 KiB
C#

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace myWebApplication
{
public partial class Uploadfile : System.Web.UI.UserControl
{
private string filepath = AppDomain.CurrentDomain.BaseDirectory;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnUpload_Click(object sender, EventArgs e)
{
if (FileUpload.HasFile == true)
{
//there is a file, save it to disk
filepath += FileUpload.FileName;
FileUpload.SaveAs(filepath);
lblStatus.Text = "File saved";
}
else
{
lblStatus.Text = "No File selected";
}
}
protected void btnBack_Click(object sender, EventArgs e)
{
Response.Redirect("default.aspx?page=0");
}
}
}