public string UploadFileToDropbox(byte[] fileBytes, string fileName)
        {
            IResource fileResource    = new ByteArrayResource(fileBytes);
            Entry     uploadFileEntry =
                this.dropbox.UploadFileAsync(fileResource, string.Format("{0}", fileName))
                .Result;
            DropboxLink sharedUrl = this.dropbox.GetMediaLinkAsync(uploadFileEntry.Path).Result;

            File.Delete(fileName);
            return(sharedUrl.Url);
        }
Example #2
0
        public async Task <string> UploadImageToCloud(
            byte[] byteArrayContent,
            string fileName,
            string fileExstension,
            string parentPath = WebStorageConstants.Collection)
        {
            string path     = "/" + parentPath + "/" + fileName + "." + fileExstension;
            var    resource = new ByteArrayResource(byteArrayContent);

            await this.dropboxApi.UploadFileAsync(resource, path);

            var mediaLink = await this.dropboxApi.GetMediaLinkAsync(path);

            return(mediaLink.Url);
        }
Example #3
0
        public string GetRedirectionUrl(string url, string wallpaperName)
        {
            byte[] imageBytes;

            using (var wc = new WebClient())
            {
                imageBytes = wc.DownloadData(url);
            }

            IResource res = new ByteArrayResource(imageBytes);

            Entry uploadFileEntry = currentDropbox.UploadFileAsync(res, string.Format("/movie-images/{0}-wallpaper.jpeg", wallpaperName)).Result;

            DropboxLink sharedUrl = currentDropbox.GetShareableLinkAsync(uploadFileEntry.Path).Result;

            var link = sharedUrl.Url;

            return(link);
        }
 public IResourceHandler CreateResourceHandler(ByteArrayResource resource)
 {
     return(new CefByteArrayResourceHandler(resource));
 }
 public void SetResource(ByteArrayResource resource)
 {
     this.logic = new ByteArrayResourceHandlerLogic <IResponse>(resource, CefResponseAdapter.Instance);
 }
 internal CefByteArrayResourceHandler(ByteArrayResource resource)
 {
     SetResource(resource);
 }