• 大小: 34KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-11
  • 语言: C#
  • 标签: HTML5  JQUERY  

资源简介

HTML5+JQUERY文件上传,手机浏览器兼容性好(asp.net例子) 已经在win7,手机uc测试通过

资源截图

代码片段和文件信息


using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text.Regularexpressions;
using System.Text;
using System.Data.Common;
using System.Data.SqlClient;
using baseClass;
using System;
using System.IO;
using System.Drawing;
using ZXing;
using ZXing.Presentation;
using ThoughtWorks.QRCode.Codec;
using ThoughtWorks.QRCode.Codec.Data;
namespace MTT
{
    public partial class html5upload_ewmdo : System.Web.UI.Page
    {
        protected void Page_Load(object sender EventArgs e)
        {

            if (Request[“action“] == “PostEwm“)
            {
                //try
                //{
                //    QRCodeDecoder decoder = new QRCodeDecoder();
                //    byte[] imgBytes = Convert.Frombase64String(Request[“img“]);
                //    Stream stream = new MemoryStream(imgBytes);
                //    String decodedString = decoder.decode(new QRCodeBitmapImage(new Bitmap(stream))Encoding.UTF8);

                //    Response.Write(decodedString);

                //}
                //catch
                //{
                //}
                try
                {

                    byte[] imgBytes = Convert.Frombase64String(Request[“img“]);
                    Stream stream = new MemoryStream(imgBytes);
                    Result result = new ZXing.BarcodeReader().Decode(new Bitmap(stream));
                    Response.Write(result.Text);
                    Response.End();
                }
                catch { Response.Write(““); Response.End(); }
            }
            else if (Request[“action“] == “PostEwmAddFile“)
            {
                try
                {
                    string filename = Request[“filename“];
                    byte[] imgBytes = Convert.Frombase64String(Request[“img“].Remove(0 Request[“img“].IndexOf(‘‘)+1));               
                    Stream stream = new MemoryStream(imgBytes);
                    MemoryStream memory= new MemoryStream(imgBytes);
                    FileStream fs = new FileStream(Server.MapPath(“/file/upload/“)+filename FileMode.Create);
                    //StreamWriter sw = new StreamWriter(stream);
                    //开始写入
                    //sw.Write(stream);
                    //清空缓冲区
                    //sw.Flush();
                    //关闭流
                   // sw.Close();
                    memory.WriteTo(fs);
                    fs.Close();

                    //Bitmap btp = new Bitmap(stream);
                   // btp.Save(Server.MapPath(“/file/upload/“)+ filename);

                }
                catch
                {
                }
                
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2435  2015-04-01 10:53  demo.html

     文件        115  2015-04-01 10:53  Ewmdo.aspx

     文件       2811  2015-04-01 10:53  Ewmdo.aspx.cs

     文件        469  2015-04-01 10:53  Ewmdo.aspx.designer.cs

     文件      95786  2015-04-01 10:53  jquery-1.11.1.min.js

     目录          0  2015-04-01 10:58  upload

----------- ---------  ---------- -----  ----

               101616                    6


评论

共有 条评论