Models/Common/Upload.cs

(开头部分) 9KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Collections;
using LitJson;
using System.IO;
using System.Globalization;
using System.Web.Configuration;

namespace NewsMangaerSystem.Models.Common
{
    public class Upload
    {
        HttpContextBase context = null;

        public string FileUrl { get; private set; }
        public string FileSUrl { get; private set; }
        public string FileMUrl { get; private set; }
        public string FileExe { get; private set; }

        public Upload(HttpContextBase httpContext)
        {
            context = httpContext;
        }
        private bool showError(string message)
        {
            Hashtable hash = new Hashtable();
            hash["error"] = 1;
            hash["message"] = message;
            return false;
        }

        public bool Up(HttpPostedFileBase imgFile)
        {
            return this.Up(imgFile, "image");
        }

        public bool Up(HttpPostedFileBase imgFile, string fileType)
        {
            String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1);

            //文件保存目录路径
            String savePath = "../attached/";

            //文件保存目录URL
            String saveUrl = "/attached/";

            //定义允许上传的文件扩展名
            Hashtable extTable = new Hashtable();
            extTable.Add("image", "gif,jpg,jpeg,png,bmp");
            extTable.Add("flash", "swf,flv");
            extTable.Add("media", "swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb");
            extTable.Add("file", "doc,docx,xls,xlsx,ppt,htm,html,txt,zip,rar,gz,bz2");

            //最大文件大小
            int maxSize = 1000000;
后面还有 198 行代码,解锁后查看完整代码

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

AI 解读

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

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