コード例 #1
0
ファイル: FileHandler.cs プロジェクト: seanlinmt/tradelr
        public string Save(Stream filestream)
        {
            try
            {
#if AZURE
                IStorage container = new AzureBlob(Constants.AZURE_CONTAINER_IMAGES, BlobContainerPublicAccessType.Container);
                bool     ok        = container.AddBlobItem(blobname, imageUpload.InputStream);
                var      url       = filename;
#else
                SaveFile(filestream, url);
#if RACKSPACE
                new Thread(() => Img.UploadImageSizes(url)).Start();
#endif
#endif
                // get filesize
                var fileinfo = new FileInfo(GeneralConstants.APP_ROOT_DIR + url);
                size = fileinfo.Length;
            }
            catch (Exception ex)
            {
                Syslog.Write(ex);
                return("");
            }
            finally
            {
                filestream.Flush();
                filestream.Close();
            }
            return(url);
        }