student/changeImg.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using System.Data.SqlClient;

public partial class student_changeImg : System.Web.UI.Page
{
    string num = "";
    string url = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (base.Request.QueryString["num"] == null)
        {
            base.Response.Redirect("SuLogin_in.aspx");
        }
        else
        {
            num = base.Request.QueryString["num"];
        }
    }
    private void upload()
    {
        if (IsPostBack)
        {
            Boolean fileOK = false;
            String path = Server.MapPath("~/student/stuimage/");
            if (FileUpload1.HasFile)
            {
                String fileExtension =
                    System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        fileOK = true;
                    }
                }
            }

            if (fileOK)
            {
                try
                {
                    FileUpload1.PostedFile.SaveAs(path
                        + FileUpload1.FileName);
                    url = "stuimage/" + FileUpload1.FileName.ToString();
                    OPDB.operate.Alert("File uploaded!");
                }
                catch (Exception ex)
                {
                    OPDB.operate.Alert("File could not be uploaded.");
                }
            }
            else
            {
后面还有 16 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。