Beispiel #1
0
        private async Task <HttpResponseMessage> UploadImage(string id, string type, FileUploadEntry fileToUpload)
        {
            MultipartFormDataContent content = new MultipartFormDataContent();

            var fileContent = new StreamContent(fileToUpload.StreamData);

            fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
            {
                Name     = "\"files\"",
                FileName = "\"" + fileToUpload.Name + "\""
            };
            fileContent.Headers.ContentType = new MediaTypeHeaderValue(fileToUpload.Type);
            content.Add(fileContent);
            return(await Http.PostAsync($"UploadImage?id={id}&type={type}", content).ConfigureAwait(false));
        }
Beispiel #2
0
 public async Task <HttpResponseMessage> UploadCommunityImage(string id, FileUploadEntry fileToUpload)
 {
     return(await UploadImage(id, "COMMUNITY", fileToUpload).ConfigureAwait(false));
 }
Beispiel #3
0
 public async Task <HttpResponseMessage> UploadEventImage(string id, FileUploadEntry fileToUpload)
 {
     return(await UploadImage(id, "EVENT", fileToUpload).ConfigureAwait(false));
 }