上周主管说,要把每次开过的发票,要下载成Pdf的文件,然后就实时的将这些发票存到云上面去。

就是这个Microsoft Azure ,微软的亲儿子。

先把代码贴上来吧,挺简单的。

 ##.链接账号密码
StorageCredentials storageCredentials = new StorageCredentials(
System.Configuration.ConfigurationManager.AppSettings["Blob_AccountName"].ToString(),
System.Configuration.ConfigurationManager.AppSettings["Blob_AccountKey"].ToString()
);
CloudStorageAccount storageAccount = new CloudStorageAccount(storageCredentials, "core.chinacloudapi.cn", true);
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container;
CloudBlockBlob blockBlob = null;//怎么去实例化声明
##.下面这个就是将文件上传到Blob中,这个acsh是你的容器的名字,后面加上"/" 就是路径了,我写的这个是年月日的文件夹
 container = blobClient.GetContainerReference("acsh/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + ""); ##.FPQQLSH这个是你传到云里的文件夹的名称。
blockBlob = container.GetBlockBlobReference(FPQQLSH);
##. 文件以byte2stream(fileByte)的形式"流"传入
byte[] fileByte = Convert.FromBase64String(Convert.ToBase64String(PDF_FILE));
blockBlob.UploadFromStreamAsync(byte2stream(fileByte));

上面加粗的就是一个路径,为了考虑到以后方便备份和迁移,在Blob容器中创建这种带有这种年月日的文件夹。

一开始在本地用Code去想了最原始的方法,就是先在本地去创建一个年月日的文件夹,还找了许多代码,最后还是不行。

不能跑一个程序就创建一个文件夹吧,到时候大批量的发票就辣么多的文件夹那可就gg了。

然后,就想到直接怼路径咋样,咦~,丢雷亩啊~~~~~~居然行了。。。

Microsoft Azure Storage Explorer的更多相关文章

  1. Microsoft Azure Storage Explorer(2)

    之前写过一个往Microsoft Azure Storage Explorer里存储的功能,现在又要把东西给下载下来. 记录一下: public string DownFileFromAzure() ...

  2. 推荐一款跨平台的 Azure Storage Explorer

    var appInsights=window.appInsights||function(config){ function r(config){t[config]=function(){var i= ...

  3. 如何访问Microsoft Azure Storage

    首先先要创建存储账户 http://www.cnblogs.com/SignalTips/p/4119128.html 可以通过以下的几个方式访问 通过Visual Studio 2013 Commu ...

  4. Microsoft Azure Storage Exployer使用指南

    概述 Microsoft Azure Storage Exployer 是微软官方推荐的一款管理Azure Storage 客户端工具,客户使用完全免费.支持Windows.Mac和Linux.用户使 ...

  5. Azure系列2.1 —— com.microsoft.azure.storage.blob

    网上azure的资料较少,尤其是API,全是英文的,中文资料更是少之又少.这次由于公司项目需要使用Azure,所以对Azure的一些学习心得做下笔记,文中不正确地方请大家指正. Azure Blob ...

  6. Microsoft Azure Storage架构分析

    Microsoft云存储服务分为两个部分,SQL Azure和Azure Storage.云存储系统的可扩展性和功能不可兼得,必须牺牲一定的关系数据库功能换取可扩展性.Microsoft实现云存储的思 ...

  7. Azure Queue Storage 基本用法 -- Azure Storage 之 Queue

    Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table. 笔者在<Azure File Storage 基 ...

  8. Azure File Storage 基本用法 -- Azure Storage 之 File

    Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table. 笔者在<Azure Blob Storage 基 ...

  9. Azure Blob Storage 基本用法 -- Azure Storage 之 Blob

    Azure Storage 是微软 Azure 云提供的云端存储解决方案,当前支持的存储类型有 Blob.Queue.File 和 Table. 笔者在<Azure Table storage ...

随机推荐

  1. php观察折模式

    <?php class Paper{ private $_observers = array(); public function register($sub){ $this->_obse ...

  2. ORM 操作

    官方文档 一.操作 基本操作 # 增 models.Tb1.objects.create(c1='xx', c2='oo') # 增加一条数据,可以接受字典类型数据 **kwargs obj = mo ...

  3. pyhton 网络爬取软考题库保存text

    #-*-coding:utf-8-*-#参考文档#https://www.crummy.com/software/BeautifulSoup/bs4/doc/index.zh.html#find-al ...

  4. 个人学习记录--取表中Name相同的最大值,非Group By,可延伸

    ), qy ), je INT); INSERT INTO @t SELECT '产品一', '北京', UNION ALL SELECT '产品一', '上海', UNION ALL SELECT ...

  5. jquery源码分析(三)——工具函数

    jQuery.extend({ expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "&quo ...

  6. 协程,greenlet原生协程库, gevent库

    协程简介 协程(coroutine),又称为微线程,纤程,是一种用户级的轻量级线程.协程拥有自己的寄存器上下文和栈. 协程调度切换时,将寄存器上下文和栈保存到其他地方,在切回来时,恢复之前保存的上下文 ...

  7. VNC Server Installation on CentOS 6.5

    In my case I have a fresh installed CentOS6.5 Server on which I will be installing the VNC-server so ...

  8. 清北学堂模拟赛d3t1 a

    [问题描述]你是能看到第一题的friends呢.——hja 怎么快速记单词呢?也许把单词分类再记单词是个不错的选择.何大爷给出了一种分单词的方法,何大爷认为两个单词是同一类的当这两个单词的各个字母的个 ...

  9. hdu 4707 bellman

    最短路的优先队列做法: #include<stdio.h> #include<queue> #include<string.h> #define N  100010 ...

  10. GPS时间系统概述和世界时系统

    6.1  GPS时间系统概述 时间包含"时刻"和"时间间隔"2个概念.所谓时刻,即发生某一现象的瞬间.在天文学和卫星定位中.与所获数据对应的时刻也称为历元.时间 ...