博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
向项目的文件夹中写入数据流
阅读量:7156 次
发布时间:2019-06-29

本文共 1691 字,大约阅读时间需要 5 分钟。

public void GetChargStationFileCount(HttpContext context)        {            var chargstationfilebll = new ChargStationFileBll();            var cPictureMessage = new Message
(); var fileid = context.Request.Params["id"]; string ret = null; if (string.IsNullOrEmpty(fileid)) { cPictureMessage.Total = 0; return; } var chargstationfile = new ChargStationFile { ZhanBh = int.Parse(fileid) }; try { var dt = chargstationfilebll.FindBy(chargstationfile); var list = ConvertHelper
.ConvertToList(dt); foreach (var li in list) { var bytes = li.FileContext; if (bytes == null) continue; var stream = new MemoryStream(bytes); var img = Image.FromStream(stream); string path = AppDomain.CurrentDomain.BaseDirectory;//获取文件的相对路径 string filePath = path + @"Scripts\pictureChargStation\SaveChargeStationFile\"; img.Save(filePath + li.Id + "." + li.FileMime); var w = img.Width; var h = img.Height; li.Width = w; li.Height = h; li.FileContext = null; } cPictureMessage.Rows = list; ret = Jss.Serialize(cPictureMessage); } catch (Exception e) { Log.Error(e); throw; } context.Response.Write(ret);

 

转载地址:http://xqhgl.baihongyu.com/

你可能感兴趣的文章
音效播放
查看>>
剑指Offer - 开始没做出来 —— 验证后序序列是否正确
查看>>
参数模型、非参数模型,讲的比较好的文章
查看>>
随机数和UIView常见方法
查看>>
hdu 4559 涂色游戏(对SG函数的深入理解,推导打SG表)
查看>>
智课雅思词汇---二十二、-al即是名词性后缀又是形容词后缀
查看>>
echart.gl.js实现动态3D柱状图
查看>>
游戏设计---游戏中战斗力计算方法(整理)
查看>>
Linux split 命令用法详解 - 切割文件[转]
查看>>
第三章 列表简介(一)
查看>>
数理统计知识点归纳
查看>>
Openstack组件实现原理 — OpenVswitch/Gre/vlan
查看>>
Javascript 笔记(4)----继承与原型链
查看>>
Spark MLib 基本统计汇总 2
查看>>
嵌套Dictionary的遍历与排序(按Key值)(二)
查看>>
AES - Rijndael 算法(三)
查看>>
第一冲刺阶段(第六天)
查看>>
AtCoder Regular Contest 100 C:Linear Approximation解题报告
查看>>
算法第3章上机实践报告
查看>>
Java 基础总结
查看>>