• 大小: 83KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: Html/CSS
  • 标签: uploadifive  

资源简介

基于H5的手机上传图片控件,Demo是用html,后台代码是.net。小白亦可看懂,直接拿来做项目。代码中附加图片处理的功能,有详细的注释。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;


namespace H5UploadDemo
{
    public partial class uploadimage_do : System.Web.UI.Page
    {
        protected void Page_Load(object sender EventArgs e)
        {
            HttpPostedFile file = Request.Files[“Filedata“];//这个参数名,在Huploadify.js中可以自由设置,原来是file
            string uploadPath = HttpContext.Current.Server.MapPath(“Uploads“ + “\\“);
            string new_name = Request[“new_name“];//当前图片的重命名

            if (file != null)
            {
                if (!Directory.Exists(uploadPath))
                {
                    Directory.CreateDirectory(uploadPath);
                }
                string fileExt = System.IO.Path.GetExtension(file.FileName);
                file.SaveAs(uploadPath + new_name + fileExt);

                //等比例缩放,保留原图,创建新图
                int width = int.Parse(Request.QueryString[“w“]);
                string originalImagePath = uploadPath + new_name + fileExt;
                string thumbnailPath = uploadPath + new_name + “_“ + fileExt;
                WhyPicture.MakeThumbnail(originalImagePath thumbnailPath width 0 “W“);
                //下面这句代码缺少的话,上传成功后上传队列的显示不会自动消失
                Response.Write(“1“);
            }
            else
            {
                Response.Write(“0“);
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-05-11 18:17  H5UploadDemo\
     目录           0  2016-05-11 18:26  H5UploadDemo\H5UploadDemo\
     文件        4892  2016-05-11 18:26  H5UploadDemo\H5UploadDemo\H5UploadDemo.csproj
     文件        1085  2016-05-11 18:45  H5UploadDemo\H5UploadDemo\H5UploadDemo.csproj.user
     目录           0  2016-05-11 18:17  H5UploadDemo\H5UploadDemo\Properties\
     文件        1325  2016-05-11 18:17  H5UploadDemo\H5UploadDemo\Properties\AssemblyInfo.cs
     目录           0  2016-05-11 19:05  H5UploadDemo\H5UploadDemo\Uploads\
     文件        1240  2016-05-11 18:17  H5UploadDemo\H5UploadDemo\Web.Debug.config
     文件        1301  2016-05-11 18:17  H5UploadDemo\H5UploadDemo\Web.Release.config
     文件         313  2016-05-11 18:17  H5UploadDemo\H5UploadDemo\Web.config
     文件        4310  2016-05-11 18:26  H5UploadDemo\H5UploadDemo\WhyPicture.cs
     目录           0  2016-05-11 18:45  H5UploadDemo\H5UploadDemo\bin\
     文件        6656  2016-05-11 18:45  H5UploadDemo\H5UploadDemo\bin\H5UploadDemo.dll
     文件       15872  2016-05-11 18:45  H5UploadDemo\H5UploadDemo\bin\H5UploadDemo.pdb
     文件        3026  2016-05-11 18:44  H5UploadDemo\H5UploadDemo\index.html
     目录           0  2016-05-11 18:21  H5UploadDemo\H5UploadDemo\js\
     文件        1238  2016-05-11 18:19  H5UploadDemo\H5UploadDemo\js\Huploadify.css
     文件        2726  2016-05-11 18:19  H5UploadDemo\H5UploadDemo\js\demo.html
     文件        1196  2016-05-11 18:19  H5UploadDemo\H5UploadDemo\js\demo2.html
     文件       94840  2016-05-11 18:20  H5UploadDemo\H5UploadDemo\js\jquery-1.7.2.min.js
     文件       18629  2016-05-11 18:37  H5UploadDemo\H5UploadDemo\js\jquery.Huploadify.js
     目录           0  2016-05-11 18:21  H5UploadDemo\H5UploadDemo\js\uploadifive\
     文件       43393  2016-05-11 18:19  H5UploadDemo\H5UploadDemo\js\uploadifive\jquery.uploadifive.js
     文件       13035  2016-05-11 18:19  H5UploadDemo\H5UploadDemo\js\uploadifive\jquery.uploadifive.min.js
     文件        2237  2016-05-11 18:19  H5UploadDemo\H5UploadDemo\js\uploadifive\uploadifive.css
     目录           0  2016-05-11 18:17  H5UploadDemo\H5UploadDemo\obj\
     目录           0  2016-05-11 18:45  H5UploadDemo\H5UploadDemo\obj\Debug\
     文件        7962  2016-05-11 18:45  H5UploadDemo\H5UploadDemo\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         368  2016-05-11 18:45  H5UploadDemo\H5UploadDemo\obj\Debug\H5UploadDemo.csproj.FileListAbsolute.txt
     文件        6656  2016-05-11 18:45  H5UploadDemo\H5UploadDemo\obj\Debug\H5UploadDemo.dll
     文件       15872  2016-05-11 18:45  H5UploadDemo\H5UploadDemo\obj\Debug\H5UploadDemo.pdb
............此处省略6个文件信息

评论

共有 条评论