Esempio n. 1
0
        public static VideoUploadResponse UploadVideo(byte[] buffer, string extension, string fileName, string uploadDomain)
        {
            VideoUploadResponse result = null;

            try
            {
                if (buffer != null && !string.IsNullOrEmpty(extension) &&
                    !string.IsNullOrEmpty(fileName) &&
                    !string.IsNullOrEmpty(uploadDomain))
                {
                    using (var client = new FileUploadClient())
                    {
                        var getResult = client.UploadVideo(new FileUploadRequest()
                        {
                            Contents      = buffer,
                            DirectoryName = uploadDomain,
                            Extension     = extension
                        });
                        getResult.ThrowIfException(true);
                        if (getResult.Success && getResult.Exception == null)
                        {
                            result = getResult.Result;
                            buffer = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }