Пример #1
0
    public void UploadFile(string name)
    {
        string coursename    = Request.QueryString["course"].ToString() + "/";
        string path          = Server.MapPath(BusyworkManage.Path + tm.ReturnTeacherID(Request.Cookies["StudentID"].Value.ToString()) + BusyworkManage.BusyworkPath + coursename + name + ".doc");
        string fileExtension = System.IO.Path.GetExtension(FUL.PostedFile.FileName).ToLower();
        bool   result        = bm.CheckFileExtension(fileExtension);

        if (result == true)
        {
            FUL.PostedFile.SaveAs(path);
            bm.InsertBusyworkName(Request.QueryString["course"].ToString(), Request.QueryString["time"].ToString(), Request.Cookies["StudentID"].Value.ToString(), name);
            Response.Write("<Script language='JavaScript'>alert('" + "添加成功!" + "');</Script>");
        }
        else
        {
            Response.Write("<Script language='JavaScript'>alert('" + "格式不正确!" + "');</Script>");
        }
    }
Пример #2
0
    public void UploadFile(string time)
    {
        string coursename = bm.ReturnCourseName(Request.QueryString["courseid"].ToString());
        //string postfileName = FUL.PostedFile.FileName.Substring(FUL.PostedFile.FileName.LastIndexOf("\\"), FUL.PostedFile.FileName.Length - FUL.PostedFile.FileName.LastIndexOf("\\"));
        string postfileName  = coursename + "_" + time + ".doc";
        string path          = Server.MapPath(BusyworkManage.Path + Request.Cookies["TeacherID"].Value.ToString() + BusyworkManage.TopicPath + coursename + "/" + postfileName);
        string fileExtension = System.IO.Path.GetExtension(FUL.PostedFile.FileName).ToLower();
        bool   result        = bm.CheckFileExtension(fileExtension);

        if (result == true)
        {
            FUL.PostedFile.SaveAs(path);
            Response.Write("<Script language='JavaScript'>alert('" + "添加成功!" + "');</Script>");
        }
        else
        {
            Response.Write("<Script language='JavaScript'>alert('" + "格式不正确!" + "');</Script>");
        }
    }