public void FileUpload(HttpContext context)
{
try
{
context.Response.ContentType = "text/html";
string companyname = context.Request.Params["companyname"];
String billno = context.Request.Params["billno"];
string filename = context.Request.Params["filename"];
string name = companyname "_" billno "_" filename;
HttpFileCollection files = HttpContext.Current.Request.Files;
//Specify the saving path of the uploaded file on the server
string savePath = context.Server.MapPath("~/upload/");
//Check whether this physical path exists on the server, if not, create it
If (!System.IO.Directory.Exists(savePath))
{
System.IO.Directory.CreateDirectory(savePath);
}
savePath = savePath name;//Upload file path
files[0].SaveAs(savePath);//Save the file
context.Response.Write(savePath);
}
catch (Exception ex)
{
context.Response.Write("FileUpload: " ex.Message);
}
}