Web/App/shop/androidupload.ashx

(开头部分) 4KB

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

<%@ WebHandler Language="C#" Class="androidupload" %>

using System;
using System.Web;

/// <summary>
/// 上传图片,注意参数
/// type=1 表示上传商家图片 id 表示商家编号
/// type=2 表示上传商品图片 id 表示商品编号
/// type=3 表示上传桌子图片 id 表示桌子编号
/// ext=jpg 表示后缀名

public class androidupload : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        //-1表示失败,1表示成功
        string state = "-1";
        string picurl = "";

        try
        {
            context.Response.ContentType = "text/plain";
            context.Response.Charset = "utf-8";

            string strDay = System.DateTime.Now.ToString("yyyyMM");
            string uploadPath = HttpContext.Current.Server.MapPath("~/upload/" + strDay);
            if (!System.IO.Directory.Exists(uploadPath))
            {
                System.IO.Directory.CreateDirectory(uploadPath);
            }

            System.IO.Stream stream = context.Request.InputStream;//这是你获得的流
            //获取参数,注意:此处参数是放在http头信息里的。
            string type = context.Request.Headers["type"];
            string id = context.Request.Headers["id"];
            string ext = context.Request.Headers["ext"];
            //string id = "850";
            
            //根据相关类型,保存到数据的功能未实现,接手的同事注意下

            string filename = System.DateTime.Now.ToString("yyyyMMddHHmmssffff") + "." + ext;

            string fullpicurl = "~/upload/" + strDay+"/"+filename;
            
            //将图片的路径保存到数据库
            switch (type)
            {
                case "1"://店名图片
                    updateshopnamepic(id, fullpicurl);
                    break;
                case "2"://店的菜单和价格图片
                    updatefoodandpricepic(id, fullpicurl);
                    break;
                case "3"://资质图片1
                    updateshoppic1(id, fullpicurl);
                    break;
                case "4"://资质图片2
                    updateshoppic2(id, fullpicurl);
                    break;
后面还有 60 行代码,购买后查看完整代码

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

AI 解读 AI

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

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