Exemple #1
0
        /// <summary>
        /// 缓存刷新
        /// </summary>
        /// <param name="imageUrl">每个url都必须以为http开头,否则不会加入刷新队列</param>
        /// <param name="location">位置(如:/a/b/c.jpg)</param>
        public static bool ReloadloadIamgeV2(string imageUrl, out string Msg)
        {
            Msg = "";
            UpYun     upyun   = new UpYun(_spaceName, _operator, _password);
            Hashtable headers = new Hashtable();

            return(upyun.reloadFileWorkerV2("POST", imageUrl, headers, out Msg));
        }
Exemple #2
0
        /// <summary>
        /// 上传图片到又拍云
        /// </summary>
        /// <param name="imageUri">上传的图片的本地位置</param>
        /// <param name="location">位置(如:/a/b/c.jpg)</param>
        public static bool UploadIamge(string imageUri, string location)
        {
            UpYun        upyun   = new UpYun(_spaceName, _operator, _password);
            Hashtable    headers = new Hashtable();
            FileStream   fs      = new FileStream(imageUri, FileMode.Open, FileAccess.Read);
            BinaryReader r       = new BinaryReader(fs);

            byte[] postArray = r.ReadBytes((int)fs.Length);
            upyun.setContentMD5(UpYun.md5_file(imageUri));
            return(upyun.writeFile(location, postArray, true));
        }
Exemple #3
0
        /// <summary>
        /// 上传图片到又拍云
        /// </summary>
        /// <param name="inputStream">图片的输入流</param>
        /// <param name="location">位置(如:/a/b/c.jpg)</param>
        public static bool UploadIamge(Stream inputStream, string location)
        {
            UpYun        _upyun  = new UpYun(_spaceName, _operator, _password);
            Hashtable    headers = new Hashtable();
            BinaryReader r       = new BinaryReader(inputStream);

            byte[] bytes = new byte[inputStream.Length];
            inputStream.Read(bytes, 0, bytes.Length);
            // 设置当前流的位置为流的开始
            inputStream.Seek(0, SeekOrigin.Begin);

            byte[] postArray = r.ReadBytes((int)inputStream.Length);
            //_upyun.setContentMD5(UpYun.md5_file("Hello, this is a f*****g image."));
            return(_upyun.writeFile(location.ToLower(), postArray, true));
        }