Пример #1
0
        public T PostWithFile <T>(string url, string fileName, byte[] fileContent, NameValueCollection parameters, HttpMethod method = null)
        {
            var headers  = InitHeaders();
            var fileType = MimeHelper.GetContentTypeByName(fileName);

            return(ChalkableHttpFileLoader.HttpUploadFile(url, fileName, fileContent, fileType
                                                          , ThrowWebException, JsonConvert.DeserializeObject <T>, parameters, headers, method ?? HttpMethod.Post));
        }
Пример #2
0
        private DocumentUploadResponse UploadFileToCrocodoc(string fileName, byte[] fileContent)
        {
            var nvc = new NameValueCollection {
                { TOKEN, GetToken() }
            };
            var fileType = MimeHelper.GetContentTypeByName(fileName);

            return(ChalkableHttpFileLoader.HttpUploadFile(UrlTools.UrlCombine(GetCrocodocApiUrl(), DOCUMENT_UPLOAD)
                                                          , fileName, fileContent, fileType, HandleUploadException, Deserialize <DocumentUploadResponse>, nvc));
        }