zoukankan      html  css  js  c++  java
  • SWFUpload后台取数据

    HttpPostedFileBase file = Request.Files["Filedata"];//接收客户端传递过来的数据.
    string fileName = Path.GetFileName(file.FileName);//获取文件名称.
    string fileExt = Path.GetExtension(fileName);//获取扩展名称.
    if (fileExt == ".jpg")
    {
    //file.SaveAs(Request.MapPath("/UploadImage/"+fileName));
    string dir = "/UploadImage/"+DateTime.Now.Year+"/"+DateTime.Now.Month+"/"+DateTime.Now.Day+"/";
    Directory.CreateDirectory(Path.GetDirectoryName(Request.MapPath(dir)));//创建目录
    string fullDir = dir +Common.WebCommon.GetStreamMD5(file.InputStream)+ fileExt;//构建完整路径.
    //图片的压缩(缩略图.)
    file.SaveAs(Request.MapPath(fullDir));
    string thumbUrl = "/UploadImage/" + Guid.NewGuid().ToString() + ".jpg";
    int height;
    Common.ImageClass.MakeThumbnail(Request.MapPath(fullDir), Request.MapPath(thumbUrl), 200, 300, "W",out height);
    // using (Image img = Image.FromStream(file.InputStream))//根据原始图创建一个Image,Image的高度与宽度就是上传图片的高度与宽度.
    return Content("ok:" + thumbUrl+":"+height);
    }
    return Content("no:格式错误!!");

  • 相关阅读:
    jquery-validate v1.19.2 源码分析
    jquery之遍历-Section04
    jquery之元素-Section03
    jquery之效果-Section02
    jquery之入门-Section01
    CSS世界(七)思维导图
    shell文件处理awk
    jquery插件懒加载
    jquery插件改变背景色
    jquery多库共存
  • 原文地址:https://www.cnblogs.com/poli/p/4419352.html
Copyright © 2011-2022 走看看